diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-09-13 21:55:22 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-09-14 10:54:27 +0200 |
commit | c1fe7b498a680a4f9d94e3633e6d9c566fb61fe4 (patch) | |
tree | 784bafbf57117134db0a54e625e93a3b222afa87 /selftest | |
parent | 881f610f06fc644bbbd146d939be5cd1adc19a73 (diff) | |
download | samba-c1fe7b498a680a4f9d94e3633e6d9c566fb61fe4.tar.gz samba-c1fe7b498a680a4f9d94e3633e6d9c566fb61fe4.tar.bz2 samba-c1fe7b498a680a4f9d94e3633e6d9c566fb61fe4.zip |
subunit: Use standard addError method implementation.
Diffstat (limited to 'selftest')
-rw-r--r-- | selftest/subunithelper.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index 3328741246..31550542f2 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -79,8 +79,7 @@ def parse_results(msg_ops, statistics, fh): if not terminated: statistics['TESTS_ERROR']+=1 - msg_ops.end_test(testname, "error", True, - "reason (%s) interrupted" % result) + msg_ops.addError(subunit.RemotedTestCase(testname), "reason (%s) interrupted" % result) return 1 else: reason = None @@ -89,8 +88,7 @@ def parse_results(msg_ops, statistics, fh): open_tests.remove(testname) except ValueError: statistics['TESTS_ERROR']+=1 - msg_ops.end_test(testname, "error", True, - "Test was never started") + msg_ops.addError(subunit.RemotedTestCase(testname), "Test was never started") else: statistics['TESTS_EXPECTED_OK']+=1 msg_ops.end_test(testname, "success", False, reason) @@ -99,8 +97,7 @@ def parse_results(msg_ops, statistics, fh): open_tests.remove(testname) except ValueError: statistics['TESTS_ERROR']+=1 - msg_ops.end_test(testname, "error", True, - "Test was never started") + msg_ops.addError(subunit.RemotedTestCase(testname), "Test was never started") else: statistics['TESTS_EXPECTED_FAIL']+=1 msg_ops.end_test(testname, "xfail", False, reason) @@ -110,8 +107,7 @@ def parse_results(msg_ops, statistics, fh): open_tests.remove(testname) except ValueError: statistics['TESTS_ERROR']+=1 - msg_ops.end_test(testname, "error", True, - "Test was never started") + msg_ops.addError(subunit.RemotedTestCase(testname), "Test was never started") else: statistics['TESTS_UNEXPECTED_FAIL']+=1 msg_ops.end_test(testname, "failure", True, reason) @@ -128,7 +124,7 @@ def parse_results(msg_ops, statistics, fh): open_tests.remove(testname) except ValueError: pass - msg_ops.end_test(testname, "error", True, reason) + msg_ops.addError(subunit.RemotedTestCase(testname), reason) elif result == "skip-testsuite": msg_ops.skip_testsuite(testname) elif result == "testsuite-success": @@ -171,6 +167,9 @@ def parse_results(msg_ops, statistics, fh): class SubunitOps(subunit.TestProtocolClient,TestsuiteEnabledTestResult): + def addError(self, test, details=None): + self.end_test(test.id(), "error", details) + def end_test(self, name, result, reason=None): if reason: self._stream.write("%s: %s [\n%s\n]\n" % (result, name, reason)) @@ -259,6 +258,9 @@ class FilterOps(testtools.testresult.TestResult): self._ops.startTest(test) + def addError(self, test, details=None): + self.end_test(test.id(), "error", details) + def end_test(self, testname, result, unexpected, reason): if self.prefix is not None: testname = self.prefix + testname |