[PATCH 2 of 2] run-tests: when interrupted report time in failure message

Simon Heimberg simohe at besonet.ch
Wed Jun 5 16:14:37 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1370462729 -7200
# Node ID e86d687ad178ce543d6b263eefdcaed6ec8062bb
# Parent  227d4459ac24fc8a5083bf62a182c78f756e3bd7
run-tests: when interrupted report time in failure message

When --time is specified, the interruption message of an interrupted test is
extended with the time the test has run

INTERRUPTED: /path/to/tests/test-example.t (after 513 seconds)

diff -r 227d4459ac24 -r e86d687ad178 tests/run-tests.py
--- a/tests/run-tests.py	Mit Jun 05 22:05:02 2013 +0200
+++ b/tests/run-tests.py	Mit Jun 05 22:05:29 2013 +0200
@@ -965,7 +965,11 @@
     try:
         ret, out = runner(testpath, testtmp, options, replacements, env)
     except KeyboardInterrupt:
-        log('INTERRUPTED:', testpath)
+        msg = ''
+        if options.time:
+            endtime = time.time()
+            msg = '(after %d seconds)' % (endtime - starttime)
+        log('INTERRUPTED:', testpath, msg)
         raise
     if options.time:
         endtime = time.time()


More information about the Mercurial-devel mailing list