Submitter | timeless@mozdev.org |
---|---|
Date | Dec. 28, 2015, 5:54 p.m. |
Message ID | <87ab92b56034a975ad99.1451325276@waste.org> |
Download | mbox | patch |
Permalink | /patch/12368/ |
State | Accepted |
Headers | show |
Comments
On Mon, Dec 28, 2015 at 11:54:36AM -0600, timeless wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1451318491 0 > # Mon Dec 28 16:01:31 2015 +0000 > # Node ID 87ab92b56034a975ad99ac1f592cdd19461c5bbc > # Parent 23541bdd1610c08af247f9c8719045cf247ce541 > run-tests: avoid double counting server fails Taking this one, but leaving patch 2 for when I have more brainpower (or another reviewer - I just don't want to wade through it at the moment.) > > diff --git a/tests/run-tests.py b/tests/run-tests.py > --- a/tests/run-tests.py > +++ b/tests/run-tests.py > @@ -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 > @@ -1242,6 +1244,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. > @@ -1360,6 +1365,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 --git a/tests/test-run-tests.t b/tests/test-run-tests.t > --- a/tests/test-run-tests.t > +++ b/tests/test-run-tests.t > @@ -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 <<EOF > > $ 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 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -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 @@ -1242,6 +1244,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. @@ -1360,6 +1365,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 --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -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 <<EOF > $ 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