Skip to content

Commit

Permalink
refactor: Ignore mypy problem when calling asyncio.runners._cancel_al…
Browse files Browse the repository at this point in the history
…l_tasks.

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
  • Loading branch information
seifertm committed Sep 13, 2022
1 parent e276f40 commit b4f4d1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pytest_asyncio/plugin.py
Expand Up @@ -360,7 +360,9 @@ def pytest_fixture_post_finalizer(fixturedef: FixtureDef, request: SubRequest) -
# Cleanup code based on the implementation of asyncio.run()
try:
if not loop.is_closed():
asyncio.runners._cancel_all_tasks(loop)
asyncio.runners._cancel_all_tasks( # type: ignore[attr-defined]
loop
)
loop.run_until_complete(loop.shutdown_asyncgens())
if sys.version_info >= (3, 9):
loop.run_until_complete(loop.shutdown_default_executor())
Expand Down

0 comments on commit b4f4d1b

Please sign in to comment.