diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index eef262d723d..af5b91d17e7 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5651,6 +5651,9 @@ def install_tests_in_module_dict(remote_globs, start_method): if need_sleep: time.sleep(0.5) multiprocessing.process._cleanup() + # 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() remote_globs['setUpModule'] = setUpModule diff --git a/Misc/NEWS.d/next/Tests/2019-07-01-19-57-26.bpo-37421.NFH1f0.rst b/Misc/NEWS.d/next/Tests/2019-07-01-19-57-26.bpo-37421.NFH1f0.rst new file mode 100644 index 00000000000..c379b504ba8 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-07-01-19-57-26.bpo-37421.NFH1f0.rst @@ -0,0 +1,2 @@ +multiprocessing tests now explicitly call ``_run_finalizers()`` to +immediately remove temporary directories created by tests.