Make run-tests.py --interactive work on Windows
authorPatrick Mezard <pmezard@gmail.com>
Sat, 05 Jan 2008 17:55:16 +0100
changeset 5800 2f597243e1d7
parent 5799 4b82d1a84db8
child 5801 1b230f506346
child 5807 4dfe7d5b1fc8
Make run-tests.py --interactive work on Windows
tests/run-tests.py
--- a/tests/run-tests.py	Fri Jan 04 23:23:47 2008 +0100
+++ b/tests/run-tests.py	Sat Jan 05 17:55:16 2008 +0100
@@ -67,6 +67,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:
@@ -528,7 +535,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