diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2018-02-09 09:51:54 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-02-09 07:59:20 +0100 |
commit | 055b7308d252d3b1501f61884defcd5bbe91049e (patch) | |
tree | 65782050f2e5a97969ee3302d4eb51a5f769cac8 /python | |
parent | d8aa50b217b16b7e809fa5d59b6240a5671e86b8 (diff) | |
download | samba-055b7308d252d3b1501f61884defcd5bbe91049e.tar.gz |
subunit.run: report failure in process return code
The protocol requires that the TestResult object remembers when it has failed, but
in subclassing unittest.TestResult we forgot to ensure this is true.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rwxr-xr-x | python/samba/subunit/run.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/python/samba/subunit/run.py b/python/samba/subunit/run.py index efaeef902c9..bb598b42452 100755 --- a/python/samba/subunit/run.py +++ b/python/samba/subunit/run.py @@ -94,6 +94,10 @@ class TestProtocolClient(unittest.TestResult): def __init__(self, stream): unittest.TestResult.__init__(self) self._stream = stream + self.failed = False + + def wasSuccessful(self): + return not self.failed def addError(self, test, error=None): """Report an error in test test. @@ -102,6 +106,7 @@ class TestProtocolClient(unittest.TestResult): exc_info tuple. """ self._addOutcome("error", test, error=error) + self.failed = True def addExpectedFailure(self, test, error=None): """Report an expected failure in test test. @@ -118,6 +123,7 @@ class TestProtocolClient(unittest.TestResult): exc_info tuple. """ self._addOutcome("failure", test, error=error) + self.failed = True def _addOutcome(self, outcome, test, error=None, error_permitted=True): """Report a failure in test test. @@ -161,6 +167,7 @@ class TestProtocolClient(unittest.TestResult): """Report an unexpected success in test test. """ self._addOutcome("uxsuccess", test, error_permitted=False) + self.failed = True def startTest(self, test): """Mark a test as starting its test run.""" |