equal
deleted
inserted
replaced
614 log("\nSkipping %s: %s" % (self._path, msg)) |
614 log("\nSkipping %s: %s" % (self._path, msg)) |
615 |
615 |
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): |
622 """A Python-based test.""" |
625 """A Python-based test.""" |
623 def _run(self, testtmp, replacements, env): |
626 def _run(self, testtmp, replacements, env): |
983 iolock = threading.Lock() |
986 iolock = threading.Lock() |
984 |
987 |
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. |
991 # It is relatively common in Python testing tools. |
997 # It is relatively common in Python testing tools. |
992 def __init__(self, *args, **kwargs): |
998 def __init__(self, *args, **kwargs): |
1340 self.runTest() |
1346 self.runTest() |
1341 except KeyboardInterrupt: |
1347 except KeyboardInterrupt: |
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: |
1348 result.addError(self, sys.exc_info()) |
1356 result.addError(self, sys.exc_info()) |
1349 else: |
1357 else: |
1354 |
1362 |
1355 if code == '!': |
1363 if code == '!': |
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) |
1366 |
1372 |
1367 # We need this proxy until tearDown() is implemented. |
1373 # We need this proxy until tearDown() is implemented. |