testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #00973
[Merge] lp:~jml/testtools/exc-info-929063 into lp:testtools
Jonathan Lange has proposed merging lp:~jml/testtools/exc-info-929063 into lp:testtools.
Requested reviews:
testtools committers (testtools-committers)
For more details, see:
https://code.launchpad.net/~jml/testtools/exc-info-929063/+merge/92332
As per bug 929063, subunit relies on testtools's TestResult having an _exc_info_to_unicode method. This is a bit annoying, as the whole point of the '_' prefix is to stop people relying on it. Anyway, to smooth out the upgrade process for people I've restored _exc_info_to_unicode in this branch, and added some comments on why.
Next step is to release, and then update subunit to use the more recent, non-private API.
--
https://code.launchpad.net/~jml/testtools/exc-info-929063/+merge/92332
Your team testtools developers is subscribed to branch lp:testtools.
=== modified file 'testtools/testresult/real.py'
--- testtools/testresult/real.py 2012-02-04 16:47:09 +0000
+++ testtools/testresult/real.py 2012-02-09 17:56:20 +0000
@@ -144,6 +144,11 @@
return TracebackContent(err, test).as_text()
return _details_to_str(details, special='traceback')
+ def _exc_info_to_unicode(self, err, test):
+ # Deprecated. Only present because subunit upcalls to it. See
+ # <https://bugs.launchpad.net/testtools/+bug/929063>.
+ return TracebackContent(err, test).as_text()
+
def _now(self):
"""Return the current 'test time'.
=== modified file 'testtools/tests/test_testresult.py'
--- testtools/tests/test_testresult.py 2012-01-10 17:22:59 +0000
+++ testtools/tests/test_testresult.py 2012-02-09 17:56:20 +0000
@@ -35,6 +35,7 @@
Content,
content_from_stream,
text_content,
+ TracebackContent,
)
from testtools.content_type import ContentType, UTF8_TEXT
from testtools.matchers import (
@@ -442,6 +443,18 @@
'...MismatchError: 1 != 2\n',
doctest.ELLIPSIS))
+ def test_exc_info_to_unicode(self):
+ # subunit upcalls to TestResult._exc_info_to_unicode, so we need to
+ # make sure that it's there.
+ #
+ # See <https://bugs.launchpad.net/testtools/+bug/929063>.
+ test = make_erroring_test()
+ exc_info = make_exception_info(RuntimeError, "foo")
+ result = self.makeResult()
+ text_traceback = result._exc_info_to_unicode(exc_info, test)
+ self.assertEqual(
+ TracebackContent(exc_info, test).as_text(), text_traceback)
+
class TestMultiTestResult(TestCase):
"""Tests for 'MultiTestResult'."""
Follow ups