-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
[3.10] gh-91676 gh-91260 unittest.IsolatedAsyncioTestCase no longer leaks its executor #91680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@asvetlov is this I believe it to be what people want this class to do. But https://docs.python.org/3.11/library/unittest.html#unittest.IsolatedAsyncioTestCase.run says nothing more than "sets up a new event loop to run the test ... at the end tasks in the event loop are cancelled" without explicitly stating what should be obvious that upon exit this new private event loop should go away. So I believe this unittest bugfix is desirable. There appears no nice way to inject this shutdown_default_executor() call as a workaround for anyone already using this class given the way the code in 3.10 and earlier is structured. |
Thanks @gpshead for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
… no longer leaks its executor (pythonGH-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 61570ae) Co-authored-by: Gregory P. Smith <[email protected]>
GH-91692 is a backport of this pull request to the 3.9 branch. |
…eaks 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 61570ae) Co-authored-by: Gregory P. Smith <[email protected]>
… no longer leaks its executor (pythonGH-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 61570ae) Co-authored-by: Gregory P. Smith <[email protected]>
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.
issues #91676 and #91260 alternate fix to #91667.
This only happened in 3.10 and 3.9 after #32086 as the main 3.11 branch has a completely rewritten
unittest.IsolatedAsyncioTestCase
that uses asyncio APIs itself that do not appear to leak the executor.