##// END OF EJS Templates
run-tests: fail tests by raising an exception...
Gregory Szorc -
r21445:092b1644 default
parent child Browse files
Show More
@@ -607,6 +607,10 b' class Test(object):'
607 if self._unittest:
607 if self._unittest:
608 if warned:
608 if warned:
609 raise WarnTest(msg)
609 raise WarnTest(msg)
610 else:
611 # unittest differentiates between errored and failed.
612 # Failed is denoted by AssertionError (by default at least).
613 raise AssertionError(msg)
610
614
611 return warned and '~' or '!', self.name, msg
615 return warned and '~' or '!', self.name, msg
612
616
@@ -1347,8 +1351,6 b' class TestRunner(object):'
1347 # Need to stash away the TestResult since we do custom things
1351 # Need to stash away the TestResult since we do custom things
1348 # with it.
1352 # with it.
1349 def run(self, result):
1353 def run(self, result):
1350 self._result = result
1351
1352 try:
1354 try:
1353 self.runTest()
1355 self.runTest()
1354 except KeyboardInterrupt:
1356 except KeyboardInterrupt:
@@ -1369,13 +1371,9 b' class TestRunner(object):'
1369 def runTest(self):
1371 def runTest(self):
1370 code, tname, msg = t.run()
1372 code, tname, msg = t.run()
1371
1373
1372 if code == '!':
1374 # All non-success conditions should be exceptions and should
1373 self._result.failures.append((self, msg))
1375 # be caught in run().
1374 # Codes handled in run().
1376 assert code == '.'
1375 elif code in ('.', 's', 'i', '~'):
1376 pass
1377 else:
1378 self.fail('Unknown test result code: %s' % code)
1379
1377
1380 # We need this proxy until tearDown() is implemented.
1378 # We need this proxy until tearDown() is implemented.
1381 def cleanup(self):
1379 def cleanup(self):
General Comments 0
You need to be logged in to leave comments. Login now