]> granicus.if.org Git - python/commitdiff
regrtest: give more information when a child process fails with an error
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 8 Aug 2012 20:37:26 +0000 (22:37 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 8 Aug 2012 20:37:26 +0000 (22:37 +0200)
different than KeyboardInterrupt

Lib/test/regrtest.py

index 15d7d0be5b6ccd29ec56b54b757c4de4d6322af5..c9ef0ff34927400a09ecf0685d05c1da742e767a 100755 (executable)
@@ -440,8 +440,11 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
             args, kwargs = json.loads(a)
             try:
                 result = runtest(*args, **kwargs)
+            except KeyboardInterrupt:
+                result = INTERRUPTED, ''
             except BaseException as e:
-                result = INTERRUPTED, e.__class__.__name__
+                traceback.print_exc()
+                result = CHILD_ERROR, str(e)
             sys.stdout.flush()
             print()   # Force a newline (just in case)
             print(json.dumps(result))
@@ -684,8 +687,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
                 sys.stdout.flush()
                 sys.stderr.flush()
                 if result[0] == INTERRUPTED:
-                    assert result[1] == 'KeyboardInterrupt'
-                    raise KeyboardInterrupt   # What else?
+                    raise KeyboardInterrupt
                 if result[0] == CHILD_ERROR:
                     raise Exception("Child error on {}: {}".format(test, result[1]))
                 test_index += 1