summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-10-09 15:05:30 +1100
committerRobert Collins <robertc@robertcollins.net>2009-10-09 15:05:30 +1100
commitcc36797e0831ed019dbfb4b37b33636f5c25abfa (patch)
tree879a830fbe5b6f87e095b9477f1a2a716f62a56b /python/subunit
parentaf6f8521c7d26966b63c66d164cc5a7e01d2e86b (diff)
downloadsubunit-git-cc36797e0831ed019dbfb4b37b33636f5c25abfa.tar.gz
Support addUnexpectedSuccess.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/__init__.py1
-rw-r--r--python/subunit/tests/test_test_protocol.py15
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()