File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -491,10 +491,11 @@ def event_loop(request: "pytest.FixtureRequest") -> Iterator[asyncio.AbstractEve
491491 yield loop
492492 # Cleanup code copied from the implementation of asyncio.run()
493493 try :
494- asyncio .runners ._cancel_all_tasks (loop )
495- loop .run_until_complete (loop .shutdown_asyncgens ())
496- if sys .version_info >= (3 , 9 ):
497- loop .run_until_complete (loop .shutdown_default_executor ())
494+ if not loop .is_closed ():
495+ asyncio .runners ._cancel_all_tasks (loop )
496+ loop .run_until_complete (loop .shutdown_asyncgens ())
497+ if sys .version_info >= (3 , 9 ):
498+ loop .run_until_complete (loop .shutdown_default_executor ())
498499 finally :
499500 loop .close ()
500501 # Call the garbage collector to trigger ResourceWarning's as soon
You can’t perform that action at this time.
0 commit comments