tests/run-tests.py
changeset 27567 54bc0e884385
parent 27564 80b53082a353
child 27602 67aa88e00fc7
equal deleted inserted replaced
27566:5d6f984c8375 27567:54bc0e884385
   583                 # As with skips, ignores also should be excluded from
   583                 # As with skips, ignores also should be excluded from
   584                 # the number of tests executed.
   584                 # the number of tests executed.
   585                 result.testsRun -= 1
   585                 result.testsRun -= 1
   586             except WarnTest as e:
   586             except WarnTest as e:
   587                 result.addWarn(self, str(e))
   587                 result.addWarn(self, str(e))
       
   588             except ReportedTest as e:
       
   589                 pass
   588             except self.failureException as e:
   590             except self.failureException as e:
   589                 # This differs from unittest in that we don't capture
   591                 # This differs from unittest in that we don't capture
   590                 # the stack trace. This is for historical reasons and
   592                 # the stack trace. This is for historical reasons and
   591                 # this decision could be revisited in the future,
   593                 # this decision could be revisited in the future,
   592                 # especially for PythonTest instances.
   594                 # especially for PythonTest instances.
  1241     """Raised to indicate that a test is to be ignored."""
  1243     """Raised to indicate that a test is to be ignored."""
  1242 
  1244 
  1243 class WarnTest(Exception):
  1245 class WarnTest(Exception):
  1244     """Raised to indicate that a test warned."""
  1246     """Raised to indicate that a test warned."""
  1245 
  1247 
       
  1248 class ReportedTest(Exception):
       
  1249     """Raised to indicate that a test already reported."""
       
  1250 
  1246 class TestResult(unittest._TextTestResult):
  1251 class TestResult(unittest._TextTestResult):
  1247     """Holds results when executing via unittest."""
  1252     """Holds results when executing via unittest."""
  1248     # Don't worry too much about accessing the non-public _TextTestResult.
  1253     # Don't worry too much about accessing the non-public _TextTestResult.
  1249     # It is relatively common in Python testing tools.
  1254     # It is relatively common in Python testing tools.
  1250     def __init__(self, options, *args, **kwargs):
  1255     def __init__(self, options, *args, **kwargs):
  1359                                            test.refpath, test.errpath)
  1364                                            test.refpath, test.errpath)
  1360                 if servefail:
  1365                 if servefail:
  1361                     self.addFailure(
  1366                     self.addFailure(
  1362                         test,
  1367                         test,
  1363                         'server failed to start (HGPORT=%s)' % test._startport)
  1368                         'server failed to start (HGPORT=%s)' % test._startport)
       
  1369                     raise ReportedTest('server failed to start')
  1364                 else:
  1370                 else:
  1365                     self.stream.write('\n')
  1371                     self.stream.write('\n')
  1366                     for line in lines:
  1372                     for line in lines:
  1367                         if PYTHON3:
  1373                         if PYTHON3:
  1368                             self.stream.flush()
  1374                             self.stream.flush()