]> granicus.if.org Git - python/commitdiff
Make a GC run before trying to clean up files left over by
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 29 Oct 2010 19:34:45 +0000 (19:34 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 29 Oct 2010 19:34:45 +0000 (19:34 +0000)
the latest test run.

Lib/test/regrtest.py

index 958582a5033df1f911aa863fc56897ea86f72b67..c4f1c8a8f5f08ba1d0c43b99f6deaac4dc1d8cfe 100755 (executable)
@@ -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