##// END OF EJS Templates
run-tests: record warnings by raising WarnTest...
Gregory Szorc -
r21444:2b7d3646 default
parent child Browse files
Show More
@@ -604,6 +604,10 b' class Test(object):'
604
604
605 return '.', self.name, ''
605 return '.', self.name, ''
606
606
607 if self._unittest:
608 if warned:
609 raise WarnTest(msg)
610
607 return warned and '~' or '!', self.name, msg
611 return warned and '~' or '!', self.name, msg
608
612
609 def skip(self, msg):
613 def skip(self, msg):
@@ -991,6 +995,9 b' class SkipTest(Exception):'
991 class IgnoreTest(Exception):
995 class IgnoreTest(Exception):
992 """Raised to indicate that a test is to be ignored."""
996 """Raised to indicate that a test is to be ignored."""
993
997
998 class WarnTest(Exception):
999 """Raised to indicate that a test warned."""
1000
994 class TestResult(unittest._TextTestResult):
1001 class TestResult(unittest._TextTestResult):
995 """Holds results when executing via unittest."""
1002 """Holds results when executing via unittest."""
996 # Don't worry too much about accessing the non-public _TextTestResult.
1003 # Don't worry too much about accessing the non-public _TextTestResult.
@@ -1350,6 +1357,8 b' class TestRunner(object):'
1350 result.addSkip(self, str(e))
1357 result.addSkip(self, str(e))
1351 except IgnoreTest, e:
1358 except IgnoreTest, e:
1352 result.addIgnore(self, str(e))
1359 result.addIgnore(self, str(e))
1360 except WarnTest, e:
1361 result.addWarn(self, str(e))
1353 except self.failureException:
1362 except self.failureException:
1354 result.addFailure(self, sys.exc_info())
1363 result.addFailure(self, sys.exc_info())
1355 except Exception:
1364 except Exception:
@@ -1362,10 +1371,8 b' class TestRunner(object):'
1362
1371
1363 if code == '!':
1372 if code == '!':
1364 self._result.failures.append((self, msg))
1373 self._result.failures.append((self, msg))
1365 elif code == '~':
1366 self._result.addWarn(self, msg)
1367 # Codes handled in run().
1374 # Codes handled in run().
1368 elif code in ('.', 's', 'i'):
1375 elif code in ('.', 's', 'i', '~'):
1369 pass
1376 pass
1370 else:
1377 else:
1371 self.fail('Unknown test result code: %s' % code)
1378 self.fail('Unknown test result code: %s' % code)
General Comments 0
You need to be logged in to leave comments. Login now