* Old style tracebacks with no encoding info are now treated as UTF8 rather
authorRobert Collins <robertc@robertcollins.net>
Fri, 11 Jun 2010 01:35:58 +0000 (13:35 +1200)
committerRobert Collins <robertc@robertcollins.net>
Fri, 11 Jun 2010 01:35:58 +0000 (13:35 +1200)
  than some-random-codec-like-ascii. (Robert Collins)

NEWS
python/subunit/__init__.py
python/subunit/details.py

diff --git a/NEWS b/NEWS
index 45a3f66131f74ed9359f80796d32baa0e994d069..fcdd6344213e41789e69f9e562fa217a29eb8a8b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ BUG FIXES
   is purely cosmetic as the parameters are passed down with no interpretation.
   (Robert Collins, #537611)
 
+* Old style tracebacks with no encoding info are now treated as UTF8 rather
+  than some-random-codec-like-ascii. (Robert Collins)
+
 * On windows, ProtocolTestCase and TestProtocolClient will set their streams to
   binary mode by calling into msvcrt; this avoids having their input or output
   mangled by the default line ending translation on that platform.
index bcba63ee11d78750fcffac94d3399a4c0d4cc006..7734852f1ce2d9484b4b77ec96f5ff6bd4d1acb3 100644 (file)
@@ -619,6 +619,8 @@ class TestProtocolClient(unittest.TestResult):
             raise ValueError
         if error is not None:
             self._stream.write(" [\n")
+            # 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_string(error, test).splitlines():
                 self._stream.write("%s\n" % line)
         else:
index acd6d0daf072541a63fc06e0cf38d11a7cb2b47f..a37b2acb932dd958baa29ec5be7e5d92cba8c3e1 100644 (file)
@@ -47,8 +47,12 @@ class SimpleDetailsParser(DetailsParser):
     def get_details(self, style=None):
         result = {}
         if not style:
+            # We know that subunit/testtools serialise [] formatted
+            # tracebacks as utf8, but perhaps we need a ReplacingContent
+            # or something like that.
             result['traceback'] = content.Content(
-                content_type.ContentType("text", "x-traceback"),
+                content_type.ContentType("text", "x-traceback",
+                {"charset": "utf8"}),
                 lambda:[self._message])
         else:
             if style == 'skip':