From b4f4d1b7ad8ec457cb991c9b339157fd6bdbdb8a Mon Sep 17 00:00:00 2001 From: Michael Seifert Date: Tue, 13 Sep 2022 21:42:48 +0200 Subject: [PATCH] refactor: Ignore mypy problem when calling asyncio.runners._cancel_all_tasks. Signed-off-by: Michael Seifert --- pytest_asyncio/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 6de47ab8..41a6cca9 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -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())