summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorJonathan Lange <jml@canonical.com>2012-02-09 18:40:15 +0000
committerJonathan Lange <jml@canonical.com>2012-02-09 18:40:15 +0000
commit02b8123129dc097b63902790b6b279e6c4afdd06 (patch)
tree796524eb36f529aaf84842d484191cf6b359c222 /python/subunit
parentc4e8b3bf04e185a2bae6eaf5f137a02f6e1b5fad (diff)
downloadsubunit-git-02b8123129dc097b63902790b6b279e6c4afdd06.tar.gz
Don't make so many assumptions about how testtools formats details.
Diffstat (limited to 'python/subunit')
-rw-r--r--python/subunit/tests/test_test_protocol.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index c93aabd..1c8bc05 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -19,9 +19,10 @@ import unittest
import os
from testtools import skipIf, TestCase
-from testtools.compat import _b, _u, BytesIO, StringIO
-from testtools.content import Content, TracebackContent
+from testtools.compat import _b, _u, BytesIO
+from testtools.content import Content, TracebackContent, text_content
from testtools.content_type import ContentType
+from testtools.testresult.real import _details_to_str
try:
from testtools.testresult.doubles import (
Python26TestResult,
@@ -87,11 +88,12 @@ class TestTestProtocolServerPipe(unittest.TestCase):
def test_story(self):
client = unittest.TestResult()
protocol = subunit.TestProtocolServer(client)
+ traceback = "foo.c:53:ERROR invalid state\n"
pipe = BytesIO(_b("test old mcdonald\n"
"success old mcdonald\n"
"test bing crosby\n"
"failure bing crosby [\n"
- "foo.c:53:ERROR invalid state\n"
+ + traceback +
"]\n"
"test an error\n"
"error an error\n"))
@@ -102,9 +104,8 @@ class TestTestProtocolServerPipe(unittest.TestCase):
[(an_error, _remote_exception_str + '\n')])
self.assertEqual(
client.failures,
- [(bing, _remote_exception_str + ": Text attachment: traceback\n"
- "------------\nfoo.c:53:ERROR invalid state\n"
- "------------\n\n")])
+ [(bing, _remote_exception_str + ": "
+ + _details_to_str({'traceback': text_content(traceback)}, 'traceback') + "\n")])
self.assertEqual(client.testsRun, 3)
def test_non_test_characters_forwarded_immediately(self):
@@ -559,9 +560,8 @@ class TestTestProtocolServerAddxFail(unittest.TestCase):
value = details
else:
if error_message is not None:
- value = subunit.RemoteError(_u("Text attachment: traceback\n"
- "------------\n") + _u(error_message) +
- _u("------------\n"))
+ value = subunit.RemoteError(
+ _details_to_str(details, special='traceback'))
else:
value = subunit.RemoteError()
self.assertEqual([