[1.11.x] Fixed #27890 -- Fixed FileNotFoundError cleanup exception in runtests.py on Python 3.6+.

Backport of 0c6c859d4e from master
This commit is contained in:
Tim Graham 2017-03-18 10:01:42 -04:00
parent 40b843488a
commit e0ddfa3af3
1 changed files with 6 additions and 0 deletions

View File

@ -233,6 +233,12 @@ def teardown(state):
# Restore the old settings.
for key, value in state.items():
setattr(settings, key, value)
# Discard the multiprocessing.util finalizer that tries to remove a
# temporary directory that's already removed by this script's
# atexit.register(shutil.rmtree, TMPDIR) handler. Prevents
# FileNotFoundError at the end of a test run on Python 3.6+ (#27890).
from multiprocessing.util import _finalizer_registry
_finalizer_registry.pop((-100, 0), None)
def actual_test_processes(parallel):