]> granicus.if.org Git - python/commitdiff
make sure mode is removable while cleaning up test droppings
authorBenjamin Peterson <benjamin@python.org>
Wed, 29 Apr 2009 22:44:15 +0000 (22:44 +0000)
committerBenjamin Peterson <benjamin@python.org>
Wed, 29 Apr 2009 22:44:15 +0000 (22:44 +0000)
Lib/test/regrtest.py

index fe7f347d1b09032bffd3b5f46c519d6634e0a8e5..dc86a74518102facc21954d813393867553ce11e 100755 (executable)
@@ -620,6 +620,7 @@ def runtest_inner(test, verbose, quiet, test_times,
 
 def cleanup_test_droppings(testname, verbose):
     import shutil
+    import stat
 
     # 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
@@ -644,6 +645,10 @@ def cleanup_test_droppings(testname, verbose):
         if verbose:
             print "%r left behind %s %r" % (testname, kind, name)
         try:
+            # if we have chmod, fix possible permissions problems
+            # that might prevent cleanup
+            if (hasattr(os, 'chmod')):
+                os.chmod(name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
             nuker(name)
         except Exception, msg:
             print >> sys.stderr, ("%r left behind %s %r and it couldn't be "