Merge lp:~vila/bzr/1086209-lc-all-c into lp:bzr

Proposed by Vincent Ladeuil on 2012-12-04
Status: Merged
Approved by: Vincent Ladeuil on 2012-12-10
Approved revision: 6573
Merged at revision: 6572
Proposed branch: lp:~vila/bzr/1086209-lc-all-c
Merge into: lp:bzr
Diff against target: 47 lines (+10/-5)
3 files modified
bzrlib/tests/test_ui.py (+0/-1)
bzrlib/ui/text.py (+7/-1)
doc/en/release-notes/bzr-2.6.txt (+3/-3)
To merge this branch: bzr merge lp:~vila/bzr/1086209-lc-all-c
Reviewer Review Type Date Requested Status
John A Meinel 2012-12-04 Approve on 2012-12-04
Review via email: mp+137862@code.launchpad.net

Commit message

Fix LC_ALL=C test failures related to utf8 stderr encoding

Description of the change

This should fix the LC_ALL=C test failures.

It's a bit weird that we didn't try to use the self.stderr encoding so I
went with a conservative fix: if something bad happens, we'll fall back to
the previous implementation.

To post a comment you must log in.
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2012-12-04 18:29, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/1086209-lc-all-c
> into lp:bzr.
>
> Requested reviews: bzr-core (bzr-core) Related bugs: Bug #1086209
> in Bazaar: "test failures in bzr.dev when run with LC_ALL=C"
> https://bugs.launchpad.net/bzr/+bug/1086209
>
> For more details, see:
> https://code.launchpad.net/~vila/bzr/1086209-lc-all-c/+merge/137862
>
> This should fix the LC_ALL=C test failures.
>
> It's a bit weird that we didn't try to use the self.stderr encoding
> so I went with a conservative fix: if something bad happens, we'll
> fall back to the previous implementation.
>

+* Fix test failures occurring only with LC_ALL=C, when prompting a user,
+ ``stdee`` encoding should be preferred over terminal encoding if
+ available. (Vincent Ladeuil, #1086209)

tyop

Otherwise:
 review: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Cygwin)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC+HCMACgkQJdeBCYSNAAP4dACfd6iuMu3YbSn+ICQMQKKZqs2L
JZUAn0iYiaxAE1q0Z0r4W1dAVkHwODx+
=lqmC
-----END PGP SIGNATURE-----

review: Approve
lp:~vila/bzr/1086209-lc-all-c updated on 2012-12-04
6573. By Vincent Ladeuil on 2012-12-04

Fix typo in news entry.

Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/test_ui.py'
--- bzrlib/tests/test_ui.py 2012-09-17 09:06:56 +0000
+++ bzrlib/tests/test_ui.py 2012-12-04 16:40:37 +0000
@@ -103,7 +103,6 @@
103 ui.stdout = tests.StringIOWrapper()103 ui.stdout = tests.StringIOWrapper()
104 ui.stderr = tests.StringIOWrapper()104 ui.stderr = tests.StringIOWrapper()
105 ui.stderr.encoding = ui.stdout.encoding = ui.stdin.encoding = 'utf8'105 ui.stderr.encoding = ui.stdout.encoding = ui.stdin.encoding = 'utf8'
106 pb = ui.nested_progress_bar()
107 password = ui.get_password(u'Hello \u1234 %(user)s', user=u'some\u1234')106 password = ui.get_password(u'Hello \u1234 %(user)s', user=u'some\u1234')
108 self.assertEqual(u'baz\u1234', password)107 self.assertEqual(u'baz\u1234', password)
109 self.assertEqual(u'Hello \u1234 some\u1234: ',108 self.assertEqual(u'Hello \u1234 some\u1234: ',
110109
=== modified file 'bzrlib/ui/text.py'
--- bzrlib/ui/text.py 2012-10-10 18:45:21 +0000
+++ bzrlib/ui/text.py 2012-12-04 16:40:37 +0000
@@ -336,7 +336,13 @@
336 if kwargs:336 if kwargs:
337 # See <https://launchpad.net/bugs/365891>337 # See <https://launchpad.net/bugs/365891>
338 prompt = prompt % kwargs338 prompt = prompt % kwargs
339 prompt = prompt.encode(osutils.get_terminal_encoding(), 'replace')339 try:
340 prompt = prompt.encode(self.stderr.encoding)
341 except (UnicodeError, AttributeError):
342 # If stderr has no encoding attribute or can't properly encode,
343 # fallback to terminal encoding for robustness (better display
344 # something to the user than aborting with a traceback).
345 prompt = prompt.encode(osutils.get_terminal_encoding(), 'replace')
340 self.clear_term()346 self.clear_term()
341 self.stdout.flush()347 self.stdout.flush()
342 self.stderr.write(prompt)348 self.stderr.write(prompt)
343349
=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- doc/en/release-notes/bzr-2.6.txt 2012-10-23 10:22:25 +0000
+++ doc/en/release-notes/bzr-2.6.txt 2012-12-04 16:40:37 +0000
@@ -104,9 +104,9 @@
104Testing104Testing
105*******105*******
106106
107.. Fixes and changes that are only relevant to bzr's test framework and 107* Fix test failures occurring only with LC_ALL=C, when prompting a user,
108 suite. This can include new facilities for writing tests, fixes to 108 ``stderr`` encoding should be preferred over terminal encoding if
109 spurious test failures and changes to the way things should be tested.109 available. (Vincent Ladeuil, #1086209)
110110
111111
112bzr 2.6b2112bzr 2.6b2