changeset 32943:750c3b1bb8a3

tests: removed ReportedTest exception The only call site called addFailure before raising, which is exactly what the failure exception handler does. So this complexity is not needed. We have test coverage of this "server failed to start" scenario and nothing appeared to change.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 03 Jun 2017 17:32:52 -0700
parents 5af78c524f34
children 404b6acfa192
files tests/run-tests.py
diffstat 1 files changed, 1 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sat Jun 03 17:22:45 2017 -0700
+++ b/tests/run-tests.py	Sat Jun 03 17:32:52 2017 -0700
@@ -717,8 +717,6 @@
                 # test we "ran", but we want to exclude skipped tests
                 # from those we count towards those run.
                 result.testsRun -= 1
-            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
@@ -1479,9 +1477,6 @@
 
 iolock = threading.RLock()
 
-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.
@@ -1578,10 +1573,8 @@
                 servefail, lines = getdiff(expected, got,
                                            test.refpath, test.errpath)
                 if servefail:
-                    self.addFailure(
-                        test,
+                    raise test.failureException(
                         'server failed to start (HGPORT=%s)' % test._startport)
-                    raise ReportedTest('server failed to start')
                 else:
                     self.stream.write('\n')
                     for line in lines: