summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-29 19:34:45 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-29 19:34:45 (GMT)
commitc14efc4e806c4e65ba07fbec3c5515b8ea14ac13 (patch)
treeb5855c1a9b97c08b29a8a936af21b23e751e0c5e /Lib/test/regrtest.py
parent72f48422e21ce7b11d92744d52478edeb7fa4b0d (diff)
downloadcpython-c14efc4e806c4e65ba07fbec3c5515b8ea14ac13.zip
cpython-c14efc4e806c4e65ba07fbec3c5515b8ea14ac13.tar.gz
cpython-c14efc4e806c4e65ba07fbec3c5515b8ea14ac13.tar.bz2
Make a GC run before trying to clean up files left over by
the latest test run.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 958582a..c4f1c8a 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -978,6 +978,12 @@ def runtest_inner(test, verbose, quiet,
def cleanup_test_droppings(testname, verbose):
import shutil
import stat
+ import gc
+
+ # First kill any dangling references to open files etc.
+ # This can also issue some ResourceWarnings which would otherwise get
+ # triggered during the following test run, and possible produce failures.
+ gc.collect()
# Try to clean up junk commonly left behind. While tests shouldn't leave
# any files or directories behind, when a test fails that can be tedious