##// END OF EJS Templates
run-tests: record skips by raising SkipTest...
Gregory Szorc -
r21442:867a1116 default
parent child Browse files
Show More
@@ -607,6 +607,9 b' class Test(object):'
607 607 return warned and '~' or '!', self.name, msg
608 608
609 609 def skip(self, msg):
610 if self._unittest:
611 raise SkipTest(msg)
612
610 613 if self._options.verbose:
611 614 log("\nSkipping %s: %s" % (self._path, msg))
612 615
@@ -979,6 +982,9 b' def run(cmd, wd, options, replacements, '
979 982
980 983 iolock = threading.Lock()
981 984
985 class SkipTest(Exception):
986 """Raised to indicate that a test is to be skipped."""
987
982 988 class TestResult(unittest._TextTestResult):
983 989 """Holds results when executing via unittest."""
984 990 # Don't worry too much about accessing the non-public _TextTestResult.
@@ -1334,6 +1340,8 b' class TestRunner(object):'
1334 1340 self.runTest()
1335 1341 except KeyboardInterrupt:
1336 1342 raise
1343 except SkipTest, e:
1344 result.addSkip(self, str(e))
1337 1345 except self.failureException:
1338 1346 result.addFailure(self, sys.exc_info())
1339 1347 except Exception:
@@ -1348,13 +1356,11 b' class TestRunner(object):'
1348 1356 self._result.failures.append((self, msg))
1349 1357 elif code == '~':
1350 1358 self._result.addWarn(self, msg)
1351 elif code == '.':
1352 # Success is handled automatically by the built-in run().
1353 pass
1354 elif code == 's':
1355 self._result.addSkip(self, msg)
1356 1359 elif code == 'i':
1357 1360 self._result.addIgnore(self, msg)
1361 # Codes handled in run().
1362 elif code in ('.', 's'):
1363 pass
1358 1364 else:
1359 1365 self.fail('Unknown test result code: %s' % code)
1360 1366
General Comments 0
You need to be logged in to leave comments. Login now