summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-03-18 10:01:42 -0400
committerTim Graham <timograham@gmail.com>2017-03-20 12:02:09 -0400
commite0ddfa3af30e8e0328cef17fd424c4337efec58e (patch)
treedb249dc73d3a7982184d5b2a428b805fa659d736
parent40b843488a1c4f2fab8e3ab895718a867cc00133 (diff)
[1.11.x] Fixed #27890 -- Fixed FileNotFoundError cleanup exception in runtests.py on Python 3.6+.
Backport of 0c6c859d4edf6e462d000da21b4fa5009cb2696f from master
-rwxr-xr-xtests/runtests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index dbd13e3d0f..6eaddbc3c5 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -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):