mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
subunit: Use standard addError method implementation.
This commit is contained in:
parent
881f610f06
commit
c1fe7b498a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user