[3.11] gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (GH-109298) (#109302)

gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (GH-109298)

test_asyncio and test_compileall now clean up multiprocessing by
calling multiprocessing _cleanup_tests(): explicitly clean up
resources and stop background processes like the resource tracker.
(cherry picked from commit 09ea4b8706)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2023-09-11 18:53:59 -07:00 committed by GitHub
parent 82a18069a1
commit abf3a68fe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -31,6 +31,7 @@ from asyncio import coroutines
from asyncio import events
from asyncio import proactor_events
from asyncio import selector_events
from multiprocessing.util import _cleanup_tests as multiprocessing_cleanup_tests
from test.test_asyncio import utils as test_utils
from test import support
from test.support import socket_helper
@ -2730,6 +2731,8 @@ class GetEventLoopTestsMixin:
# multiprocessing.synchronize module cannot be imported.
support.skip_if_broken_multiprocessing_synchronize()
self.addCleanup(multiprocessing_cleanup_tests)
async def main():
pool = concurrent.futures.ProcessPoolExecutor()
result = await self.loop.run_in_executor(