Merge with crew-stable
authorPatrick Mezard <pmezard@gmail.com>
Sat, 05 Jan 2008 22:52:28 +0100
changeset 5807 4dfe7d5b1fc8
parent 5806 a3a380af8fb5 (current diff)
parent 5800 2f597243e1d7 (diff)
child 5808 80e40ef3d8b8
Merge with crew-stable
tests/run-tests.py
--- a/tests/run-tests.py	Sat Jan 05 11:46:00 2008 +0900
+++ b/tests/run-tests.py	Sat Jan 05 22:52:28 2008 +0100
@@ -68,6 +68,13 @@
     print >> sys.stderr, 'ERROR: cannot mix -interactive and --jobs > 1'
     sys.exit(1)
 
+def rename(src, dst):
+    """Like os.rename(), trade atomicity and opened files friendliness
+    for existing destination support.
+    """
+    shutil.copy(src, dst)
+    os.remove(src)
+
 def vlog(*msg):
     if verbose:
         for m in msg:
@@ -530,7 +537,7 @@
                     print "Accept this change? [n] ",
                     answer = sys.stdin.readline().strip()
                     if answer.lower() in "y yes".split():
-                        os.rename(test + ".err", test + ".out")
+                        rename(test + ".err", test + ".out")
                         tested += 1
                         continue
                 failed += 1