Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/unittest/async_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def _tearDownAsyncioLoop(self):
# shutdown asyncgens
loop.run_until_complete(loop.shutdown_asyncgens())
finally:
# Prevent our executor environment from leaking to future tests.
loop.run_until_complete(loop.shutdown_default_executor())
asyncio.set_event_loop(None)
loop.close()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix :class:`unittest.IsolatedAsyncioTestCase` to shutdown the per test event
loop executor before returning from its ``run`` method so that a not yet
stopped or garbage collected executor state does not persist beyond the
test.