catch KeyboardInterrupt in run-tests
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Thu, 11 May 2006 14:06:18 +0200
changeset 2258 7e43d68f3900
parent 2257 8dafccbcede9
child 2259 181b0643ffb1
catch KeyboardInterrupt in run-tests
tests/run-tests.py
--- a/tests/run-tests.py	Thu May 11 11:24:28 2006 +0200
+++ b/tests/run-tests.py	Thu May 11 14:06:18 2006 +0200
@@ -242,24 +242,28 @@
 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
 
 try:
-    install_hg()
+    try:
+        install_hg()
 
-    tests = 0
-    failed = 0
+        tests = 0
+        failed = 0
 
-    if len(args) == 0:
-        args = os.listdir(".")
-    for test in args:
-        if test.startswith("test-"):
-            if '~' in test or re.search(r'\.(out|err)$', test):
-                continue
-            if not run_one(test):
-                failed += 1
-            tests += 1
+        if len(args) == 0:
+            args = os.listdir(".")
+        for test in args:
+            if test.startswith("test-"):
+                if '~' in test or re.search(r'\.(out|err)$', test):
+                    continue
+                if not run_one(test):
+                    failed += 1
+                tests += 1
 
-    print "\n# Ran %d tests, %d failed." % (tests, failed)
-    if coverage:
-        output_coverage()
+        print "\n# Ran %d tests, %d failed." % (tests, failed)
+        if coverage:
+            output_coverage()
+    except KeyboardInterrupt:
+        failed = True
+        print "\ninterrupted!"
 finally:
     cleanup_exit()