mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
Correctly increment counters in Subunit test runner.
This commit is contained in:
@ -21,6 +21,4 @@ from subunit import SubunitTestRunner
|
|||||||
import sys
|
import sys
|
||||||
from unittest import TestProgram
|
from unittest import TestProgram
|
||||||
|
|
||||||
program = TestProgram(module=None, argv=sys.argv,
|
TestProgram(module=None, argv=sys.argv, testRunner=SubunitTestRunner())
|
||||||
testRunner=SubunitTestRunner())
|
|
||||||
program.runTests()
|
|
||||||
|
@ -218,6 +218,7 @@ class TestProtocolClient(unittest.TestResult):
|
|||||||
for line in self._exc_info_to_string(error, test).splitlines():
|
for line in self._exc_info_to_string(error, test).splitlines():
|
||||||
self._stream.write("%s\n" % line)
|
self._stream.write("%s\n" % line)
|
||||||
self._stream.write("]\n")
|
self._stream.write("]\n")
|
||||||
|
super(TestProtocolClient, self).addError(test, error)
|
||||||
|
|
||||||
def addFailure(self, test, error):
|
def addFailure(self, test, error):
|
||||||
"""Report a failure in test test."""
|
"""Report a failure in test test."""
|
||||||
@ -225,14 +226,17 @@ class TestProtocolClient(unittest.TestResult):
|
|||||||
for line in self._exc_info_to_string(error, test).splitlines():
|
for line in self._exc_info_to_string(error, test).splitlines():
|
||||||
self._stream.write("%s\n" % line)
|
self._stream.write("%s\n" % line)
|
||||||
self._stream.write("]\n")
|
self._stream.write("]\n")
|
||||||
|
super(TestProtocolClient, self).addFailure(test, error)
|
||||||
|
|
||||||
def addSuccess(self, test):
|
def addSuccess(self, test):
|
||||||
"""Report a success in a test."""
|
"""Report a success in a test."""
|
||||||
self._stream.write("successful: %s\n" % (test.shortDescription() or str(test)))
|
self._stream.write("successful: %s\n" % (test.shortDescription() or str(test)))
|
||||||
|
super(TestProtocolClient, self).addSuccess(test)
|
||||||
|
|
||||||
def startTest(self, test):
|
def startTest(self, test):
|
||||||
"""Mark a test as starting its test run."""
|
"""Mark a test as starting its test run."""
|
||||||
self._stream.write("test: %s\n" % (test.shortDescription() or str(test)))
|
self._stream.write("test: %s\n" % (test.shortDescription() or str(test)))
|
||||||
|
super(TestProtocolClient, self).startTest(test)
|
||||||
|
|
||||||
|
|
||||||
def RemoteError(description=""):
|
def RemoteError(description=""):
|
||||||
@ -379,6 +383,5 @@ class SubunitTestRunner:
|
|||||||
def run(self, test):
|
def run(self, test):
|
||||||
"Run the given test case or test suite."
|
"Run the given test case or test suite."
|
||||||
result = TestProtocolClient(self.stream)
|
result = TestProtocolClient(self.stream)
|
||||||
test(result)
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user