bpo-38546: multiprocessing tests stop the resource tracker (GH-17641)

Multiprocessing and concurrent.futures tests now stop the resource
tracker process when tests complete.

Add ResourceTracker._stop() method to
multiprocessing.resource_tracker.

Add _cleanup_tests() helper function to multiprocessing.util: share
code between multiprocessing and concurrent.futures tests.
This commit is contained in:
Victor Stinner 2019-12-17 18:37:26 +01:00 committed by GitHub
parent 630c8df5cf
commit 9707e8e22d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 21 deletions

View file

@ -5695,16 +5695,7 @@ def install_tests_in_module_dict(remote_globs, start_method):
if need_sleep:
time.sleep(0.5)
multiprocessing.process._cleanup()
# Stop the ForkServer process if it's running
from multiprocessing import forkserver
forkserver._forkserver._stop()
# bpo-37421: Explicitly call _run_finalizers() to remove immediately
# temporary directories created by multiprocessing.util.get_temp_dir().
multiprocessing.util._run_finalizers()
test.support.gc_collect()
multiprocessing.util._cleanup_tests()
remote_globs['setUpModule'] = setUpModule
remote_globs['tearDownModule'] = tearDownModule