tests: add -i switch
authorMatt Mackall <mpm@selenic.com>
Wed, 08 Nov 2006 13:20:08 -0600
changeset 3626 02e9355c3420
parent 3625 cc0cd5942223
child 3627 44e75d9fa654
child 3664 cabe62800120
tests: add -i switch Prompt to accept changes for tests where output changed
tests/run-tests.py
--- a/tests/run-tests.py	Wed Nov 08 13:20:08 2006 -0600
+++ b/tests/run-tests.py	Wed Nov 08 13:20:08 2006 -0600
@@ -38,6 +38,8 @@
     help="exit on the first test failure")
 parser.add_option("-R", "--restart", action="store_true",
     help="restart at last error")
+parser.add_option("-i", "--interactive", action="store_true",
+    help="prompt to accept changed output")
 
 parser.set_defaults(timeout=180)
 (options, args) = parser.parse_args()
@@ -391,6 +393,13 @@
             if ret is None:
                 skipped += 1
             elif not ret:
+                if options.interactive:
+                    print "Accept this change? [n] ",
+                    answer = sys.stdin.readline().strip()
+                    if answer.lower() in "y yes".split():
+                        os.rename(test + ".err", test + ".out")
+                        tested += 1
+                        continue
                 failed += 1
                 if options.first:
                     break