mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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.
(cherry picked from commit 61570ae0bc
)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
3b6072e7f5
commit
cb3c85d40d
2 changed files with 6 additions and 0 deletions
|
@ -148,6 +148,8 @@ class IsolatedAsyncioTestCase(TestCase):
|
|||
# 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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue