##// END OF EJS Templates
run-tests: record ignored tests by raising IgnoreTest
Gregory Szorc -
r21443:a6845a04 default
parent child Browse files
Show More
@@ -616,6 +616,9 b' class Test(object):'
616 return 's', self.name, msg
616 return 's', self.name, msg
617
617
618 def ignore(self, msg):
618 def ignore(self, msg):
619 if self._unittest:
620 raise IgnoreTest(msg)
621
619 return 'i', self.name, msg
622 return 'i', self.name, msg
620
623
621 class PythonTest(Test):
624 class PythonTest(Test):
@@ -985,6 +988,9 b' iolock = threading.Lock()'
985 class SkipTest(Exception):
988 class SkipTest(Exception):
986 """Raised to indicate that a test is to be skipped."""
989 """Raised to indicate that a test is to be skipped."""
987
990
991 class IgnoreTest(Exception):
992 """Raised to indicate that a test is to be ignored."""
993
988 class TestResult(unittest._TextTestResult):
994 class TestResult(unittest._TextTestResult):
989 """Holds results when executing via unittest."""
995 """Holds results when executing via unittest."""
990 # Don't worry too much about accessing the non-public _TextTestResult.
996 # Don't worry too much about accessing the non-public _TextTestResult.
@@ -1342,6 +1348,8 b' class TestRunner(object):'
1342 raise
1348 raise
1343 except SkipTest, e:
1349 except SkipTest, e:
1344 result.addSkip(self, str(e))
1350 result.addSkip(self, str(e))
1351 except IgnoreTest, e:
1352 result.addIgnore(self, str(e))
1345 except self.failureException:
1353 except self.failureException:
1346 result.addFailure(self, sys.exc_info())
1354 result.addFailure(self, sys.exc_info())
1347 except Exception:
1355 except Exception:
@@ -1356,10 +1364,8 b' class TestRunner(object):'
1356 self._result.failures.append((self, msg))
1364 self._result.failures.append((self, msg))
1357 elif code == '~':
1365 elif code == '~':
1358 self._result.addWarn(self, msg)
1366 self._result.addWarn(self, msg)
1359 elif code == 'i':
1360 self._result.addIgnore(self, msg)
1361 # Codes handled in run().
1367 # Codes handled in run().
1362 elif code in ('.', 's'):
1368 elif code in ('.', 's', 'i'):
1363 pass
1369 pass
1364 else:
1370 else:
1365 self.fail('Unknown test result code: %s' % code)
1371 self.fail('Unknown test result code: %s' % code)
General Comments 0
You need to be logged in to leave comments. Login now