summaryrefslogtreecommitdiff
path: root/python/subunit/tests
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-10-05 06:20:25 +1100
committerRobert Collins <robertc@robertcollins.net>2009-10-05 06:20:25 +1100
commitaa757dce0d1ca43a66a5f008e05699a0230b0d59 (patch)
tree15236c95ed2aebd00678d32cfdcb021a85e66713 /python/subunit/tests
parent1bb81bd80c26f41555f676d9f6b164be9c061e61 (diff)
downloadsubunit-git-aa757dce0d1ca43a66a5f008e05699a0230b0d59.tar.gz
Hook addFailure to to details.
Diffstat (limited to 'python/subunit/tests')
-rw-r--r--python/subunit/tests/test_test_protocol.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index f505626..1b48290 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -21,7 +21,7 @@ import os
import sys
import subunit
-from subunit.content import Content
+from subunit.content import Content, TracebackContent
from subunit.content_type import ContentType
import subunit.iso8601 as iso8601
@@ -1056,6 +1056,9 @@ class TestTestProtocolClient(unittest.TestCase):
self.test = TestTestProtocolClient("test_start_test")
self.sample_details = {'something':Content(
ContentType('text', 'plain'), lambda:['serialised\nform'])}
+ self.sample_tb_details = dict(self.sample_details)
+ self.sample_tb_details['traceback'] = TracebackContent(
+ subunit.RemoteError("boo qux"))
def test_start_test(self):
"""Test startTest on a TestProtocolClient."""
@@ -1074,13 +1077,13 @@ class TestTestProtocolClient(unittest.TestCase):
self.io.getvalue(), "successful: %s\n" % self.test.id())
def test_add_success_details(self):
- """Test addSuccess on a TestProtocolClient."""
+ """Test addSuccess on a TestProtocolClient with details."""
self.protocol.addSuccess(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())
+ "15\nserialised\nform0\n]\n" % self.test.id())
def test_add_failure(self):
"""Test addFailure on a TestProtocolClient."""
@@ -1090,6 +1093,22 @@ class TestTestProtocolClient(unittest.TestCase):
self.io.getvalue(),
'failure: %s [\nRemoteException: boo qux\n]\n' % self.test.id())
+ def test_add_failure_details(self):
+ """Test addFailure on a TestProtocolClient with details."""
+ self.protocol.addFailure(
+ self.test, details=self.sample_tb_details)
+ self.assertEqual(
+ self.io.getvalue(),
+ "failure: %s [ multipart\n"
+ "Content-Type: text/plain\n"
+ "something\n"
+ "15\nserialised\nform0\n"
+ "Content-Type: text/x-traceback;language=python\n"
+ "traceback\n"
+ "25\nRemoteException: boo qux\n0\n"
+ "]\n" % self.test.id())
+
+
def test_add_error(self):
"""Test stopTest on a TestProtocolClient."""
self.protocol.addError(