← Back to team overview

yellow team mailing list archive

[Merge] lp:~frankban/lpbuildbot/unicode-decode-error into lp:~launchpad/lpbuildbot/public

 

Francesco Banconi has proposed merging lp:~frankban/lpbuildbot/unicode-decode-error into lp:~launchpad/lpbuildbot/public.

Requested reviews:
  Launchpad Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~frankban/lpbuildbot/unicode-decode-error/+merge/106173

== Summary ==

`SubunitObserver.format_error` doesn't handle non-asci chars in the error description.
See http://pastebin.ubuntu.com/975707/

== Changes ==

Decode `error_text` in `SubunitObserver.format_error`.

== Tests ==

$ python bzrbuildbot/subunittest.py 
............................
----------------------------------------------------------------------
Ran 28 tests in 0.006s

OK

-- 
https://code.launchpad.net/~frankban/lpbuildbot/unicode-decode-error/+merge/106173
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/lpbuildbot/unicode-decode-error into lp:~launchpad/lpbuildbot/public.
=== modified file 'bzrbuildbot/subunittest.py'
--- bzrbuildbot/subunittest.py	2012-04-30 18:32:45 +0000
+++ bzrbuildbot/subunittest.py	2012-05-17 12:49:17 +0000
@@ -81,7 +81,7 @@
             '%s: %s\n' % (label, test_id),
             'worker ID: %s\n' % self.current_worker_id(),
             self.sep2,
-            error_text,
+            error_text.decode('utf-8', 'replace'),
             ])
 
     ### Begin TestResult methods.
@@ -465,6 +465,18 @@
         self.assertIn('summary', step.logs)
         self.assertIn('DETAILS', step.logs['summary'][0])
 
+    def test_non_ascii_characters_are_reported_in_failure_details(self):
+        # A failure containing non-ascii characters is correctly reported.
+        msg = '\xc2\xa3'
+        step = FauxStep()
+        observer = SubunitObserver(step)
+        observer.outLineReceived('test: foo')
+        observer.outLineReceived('failure: foo [')
+        observer.outLineReceived(msg)
+        observer.outLineReceived(']')
+        self.assertIn('summary', step.logs)
+        self.assertIn(msg.decode('utf-8'), step.logs['summary'][0])
+
 
 class TestSubunitObserverErrorFormatting(unittest.TestCase):
     """The format_error method is used to make presentable errors."""


Follow ups