Merge lp:~vila/bzr/563997-selftest-unicode-reporting into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~vila/bzr/563997-selftest-unicode-reporting
Merge into: lp:bzr
Diff against target: 33 lines (+5/-2)
2 files modified
NEWS (+3/-0)
bzrlib/tests/__init__.py (+2/-2)
To merge this branch: bzr merge lp:~vila/bzr/563997-selftest-unicode-reporting
Reviewer Review Type Date Requested Status
Martin Pool Approve
Robert Collins Pending
bzr-core Pending
Review via email: mp+23501@code.launchpad.net

Commit message

Stop using ui.note for selftest strings that may be unicode, its not safe enough [yet].

Description of the change

When a test fails and the associated log or output can contain unicode chars.
ui.note() fails to encode them properly.

I don't know why we still use ui.note there and self.stream.write everywhere else but I
suspect a fallout from the transition to testtools.

AFAICS, there is no need to clear the progress bar so I just replace the ui.notes()
calls with self.stream.write() calls.

Robert, Martin, can you have a look and confirm ?

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

bug #563997 for easier reference.

Revision history for this message
Robert Collins (lifeless) wrote :

It looks like ui.note is the more appropriate thing, to me.

Revision history for this message
Martin Pool (mbp) :
review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

Queued on 2010-04-16 08:10:22.961453+00:00 now submitted to PQM.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-04-15 15:03:15 +0000
+++ NEWS 2010-04-15 20:47:31 +0000
@@ -40,6 +40,9 @@
40* ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in40* ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in
41 config as in previous versions of bzrlib. (Robert Collins)41 config as in previous versions of bzrlib. (Robert Collins)
4242
43* ``bzr selftest`` should not use ui.note() since it's not unicode safe.
44 (Vincent Ladeuil, #563997)
45
43* Fix glitch in the warning about unclean trees display.46* Fix glitch in the warning about unclean trees display.
44 (Vincent Ladeuil, #562665)47 (Vincent Ladeuil, #562665)
4548
4649
=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py 2010-04-15 15:03:15 +0000
+++ bzrlib/tests/__init__.py 2010-04-15 20:47:31 +0000
@@ -489,13 +489,13 @@
489 return self._shortened_test_description(test)489 return self._shortened_test_description(test)
490490
491 def report_error(self, test, err):491 def report_error(self, test, err):
492 self.ui.note('ERROR: %s\n %s\n' % (492 self.stream.write('ERROR: %s\n %s\n' % (
493 self._test_description(test),493 self._test_description(test),
494 err[1],494 err[1],
495 ))495 ))
496496
497 def report_failure(self, test, err):497 def report_failure(self, test, err):
498 self.ui.note('FAIL: %s\n %s\n' % (498 self.stream.write('FAIL: %s\n %s\n' % (
499 self._test_description(test),499 self._test_description(test),
500 err[1],500 err[1],
501 ))501 ))