minor global state nit in status blackbox tests
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 22 20:00:48 BST 2006
Robert Collins wrote:
> Hi, these two blackbox status tests set bzrlib.user_encoding globally,
> which seems undesirable. Perhaps run_bzr should be capable of setting
> the user_encoding for the command being run ?
>
> -Rob & Martin
We actually already have run_bzr(encoding=XXXX)
>
>
> def test_stdout_ascii(self):
> sys.stdout = StringIO()
> bzrlib.user_encoding = 'ascii'
> working_tree = self.make_uncommitted_tree()
> stdout, stderr = self.run_bzr("status")
>
> self.assertEquals(stdout, """\
> added:
> hell?
> """)
>
> def test_stdout_latin1(self):
> sys.stdout = StringIO()
> bzrlib.user_encoding = 'latin-1'
> working_tree = self.make_uncommitted_tree()
> stdout, stderr = self.run_bzr('status')
>
> self.assertEquals(stdout, u"""\
> added:
> hell\u00d8
> """.encode('latin-1'))
>
These were probably trying to copy the code in tests_non_ascii.py which
as part of setUp() know to reset bzrlib.user_encoding back to its
original value.
I've also already added 'run_bzr_decode()' which reads the output and
translates it back into Unicode.
You can arguably just move these tests into
bzrlib/tests/blackbox/test_non_ascii.py, and keep the Unicode compliance
tests in one file. Or we can fix these tests by changing
run_bzr('status', encoding='latin-1')
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060822/184ef66d/attachment.pgp
More information about the bazaar
mailing list