# HG changeset patch # User timeless # Date 1451318491 0 # Node ID 54bc0e884385a8d6082f683eac1fc077601ce3a8 # Parent 5d6f984c83752a16401f401ffa5123a1da7b247a run-tests: avoid double counting server fails diff -r 5d6f984c8375 -r 54bc0e884385 tests/run-tests.py --- a/tests/run-tests.py Mon Dec 14 23:50:02 2015 +0900 +++ b/tests/run-tests.py Mon Dec 28 16:01:31 2015 +0000 @@ -585,6 +585,8 @@ result.testsRun -= 1 except WarnTest as e: result.addWarn(self, str(e)) + except ReportedTest as e: + pass except self.failureException as e: # This differs from unittest in that we don't capture # the stack trace. This is for historical reasons and @@ -1243,6 +1245,9 @@ class WarnTest(Exception): """Raised to indicate that a test warned.""" +class ReportedTest(Exception): + """Raised to indicate that a test already reported.""" + class TestResult(unittest._TextTestResult): """Holds results when executing via unittest.""" # Don't worry too much about accessing the non-public _TextTestResult. @@ -1361,6 +1366,7 @@ self.addFailure( test, 'server failed to start (HGPORT=%s)' % test._startport) + raise ReportedTest('server failed to start') else: self.stream.write('\n') for line in lines: diff -r 5d6f984c8375 -r 54bc0e884385 tests/test-run-tests.t --- a/tests/test-run-tests.t Mon Dec 14 23:50:02 2015 +0900 +++ b/tests/test-run-tests.t Mon Dec 28 16:01:31 2015 +0000 @@ -209,8 +209,6 @@ Verify that when a process fails to start we show a useful message ================================================================== -NOTE: there is currently a bug where this shows "2 failed" even though -it's actually the same test being reported for failure twice. $ cat > test-serve-fail.t < $ echo 'abort: child process failed to start blah' @@ -219,11 +217,8 @@ ERROR: test-serve-fail.t output changed ! - ERROR: test-serve-fail.t output changed - ! Failed test-serve-fail.t: server failed to start (HGPORT=*) (glob) - Failed test-serve-fail.t: output changed - # Ran 1 tests, 0 skipped, 0 warned, 2 failed. + # Ran 1 tests, 0 skipped, 0 warned, 1 failed. python hash seed: * (glob) [1] $ rm test-serve-fail.t