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
1=== modified file 'NEWS'
2--- NEWS 2010-04-15 15:03:15 +0000
3+++ NEWS 2010-04-15 20:47:31 +0000
4@@ -40,6 +40,9 @@
5 * ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in
6 config as in previous versions of bzrlib. (Robert Collins)
7
8+* ``bzr selftest`` should not use ui.note() since it's not unicode safe.
9+ (Vincent Ladeuil, #563997)
10+
11 * Fix glitch in the warning about unclean trees display.
12 (Vincent Ladeuil, #562665)
13
14
15=== modified file 'bzrlib/tests/__init__.py'
16--- bzrlib/tests/__init__.py 2010-04-15 15:03:15 +0000
17+++ bzrlib/tests/__init__.py 2010-04-15 20:47:31 +0000
18@@ -489,13 +489,13 @@
19 return self._shortened_test_description(test)
20
21 def report_error(self, test, err):
22- self.ui.note('ERROR: %s\n %s\n' % (
23+ self.stream.write('ERROR: %s\n %s\n' % (
24 self._test_description(test),
25 err[1],
26 ))
27
28 def report_failure(self, test, err):
29- self.ui.note('FAIL: %s\n %s\n' % (
30+ self.stream.write('FAIL: %s\n %s\n' % (
31 self._test_description(test),
32 err[1],
33 ))