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 @@ -487,10 +487,11 @@ def event_loop(request: "pytest.FixtureRequest") -> Iterator[asyncio.AbstractEve
487487 yield loop
488488 # Cleanup code copied from the implementation of asyncio.run()
489489 try :
490- asyncio .runners ._cancel_all_tasks (loop )
491- loop .run_until_complete (loop .shutdown_asyncgens ())
492- if sys .version_info >= (3 , 9 ):
493- loop .run_until_complete (loop .shutdown_default_executor ())
490+ if not loop .is_closed ():
491+ asyncio .runners ._cancel_all_tasks (loop )
492+ loop .run_until_complete (loop .shutdown_asyncgens ())
493+ if sys .version_info >= (3 , 9 ):
494+ loop .run_until_complete (loop .shutdown_default_executor ())
494495 finally :
495496 loop .close ()
496497 # Call the garbage collector to trigger ResourceWarning's as soon
You can’t perform that action at this time.
0 commit comments