From c4e8b3bf04e185a2bae6eaf5f137a02f6e1b5fad Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Thu, 9 Feb 2012 18:04:37 +0000 Subject: Fix to call the public API in testtools. --- python/subunit/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/subunit') diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py index b4c9397..2b494de 100644 --- a/python/subunit/__init__.py +++ b/python/subunit/__init__.py @@ -123,6 +123,7 @@ import sys import unittest from testtools import content, content_type, ExtendedToOriginalDecorator +from testtools.content import TracebackContent from testtools.compat import _b, _u, BytesIO, StringIO try: from testtools.testresult.real import _StringException @@ -682,10 +683,9 @@ class TestProtocolClient(testresult.TestResult): raise ValueError if error is not None: self._stream.write(self._start_simple) - # XXX: this needs to be made much stricter, along the lines of - # Martin[gz]'s work in testtools. Perhaps subunit can use that? - for line in self._exc_info_to_unicode(error, test).splitlines(): - self._stream.write(("%s\n" % line).encode('utf8')) + content = TracebackContent(error, test) + for bytes in content.iter_bytes(): + self._stream.write(bytes) elif details is not None: self._write_details(details) else: -- cgit v1.2.1