mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
[3.10] gh-91676 gh-91260 unittest.IsolatedAsyncioTestCase no longer leaks its executor (GH-91680)
For things like test_asyncio.test_thread this was causing frequent "environment modified by test" errors as the executor threads had not always stopped running after the test was over.
This commit is contained in:
parent
0897a0bf9c
commit
61570ae0bc
2 changed files with 6 additions and 0 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue