diff options
| author | Robert Collins <robertc@robertcollins.net> | 2009-10-09 15:05:30 +1100 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2009-10-09 15:05:30 +1100 |
| commit | 73bb73395f022959faa9a8374a109c05b9c469a1 (patch) | |
| tree | 879a830fbe5b6f87e095b9477f1a2a716f62a56b /python | |
| parent | 6ef582c9d5801395fbc7c2cabc30d0c0ba070f0a (diff) | |
| download | subunit-73bb73395f022959faa9a8374a109c05b9c469a1.tar.gz | |
Support addUnexpectedSuccess.
Diffstat (limited to 'python')
| -rw-r--r-- | python/subunit/__init__.py | 1 | ||||
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index b5d7d76..5b482e3 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -563,6 +563,7 @@ class TestProtocolClient(unittest.TestResult): else: self._write_details(details) self._stream.write("]\n") + addUnexpectedSuccess = addSuccess def startTest(self, test): """Mark a test as starting its test run.""" diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index e909d3f..c2c62bc 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -1208,6 +1208,21 @@ class TestTestProtocolClient(unittest.TestCase): "time: 2009-10-11 12:13:14.000015Z\n", self.io.getvalue()) + def test_add_unexpected_success(self): + """Test addUnexpectedSuccess on a TestProtocolClient.""" + self.protocol.addUnexpectedSuccess(self.test) + self.assertEqual( + self.io.getvalue(), "successful: %s\n" % self.test.id()) + + def test_add_unexpected_success_details(self): + """Test addUnexpectedSuccess on a TestProtocolClient with details.""" + self.protocol.addUnexpectedSuccess(self.test, details=self.sample_details) + self.assertEqual( + self.io.getvalue(), "successful: %s [ multipart\n" + "Content-Type: text/plain\n" + "something\n" + "15\nserialised\nform0\n]\n" % self.test.id()) + def test_suite(): loader = subunit.tests.TestUtil.TestLoader() |
