[RFC] more encodings tests [was: bzr handles unicode]

Alexander Belchenko bialix at ukr.net
Sat Jan 7 15:51:58 GMT 2006


John Arbash Meinel пишет:
> Alexander Belchenko wrote:
>>+    def test_stdout_ascii(self):
>>+        sys.stdout = StringIO()
>>+        bzrlib.user_encoding = 'ascii'
>>+        working_tree = self.make_uncommitted_tree()
>>+        stdout, stderr = self.run_bzr_captured(["--no-plugins", "status"])
> 
> 
> Looking at this closer, is there a reason you are using '--no-plugins'?
> I don't believe it has any effect at this point. run_bzr_captured() just
> calls into the library, it doesn't spawn bzr. So unless you run 'bzr
> --no-plugins selftest' the plugins are already loaded.

I'm was not sure about how run_bzr works so I think that extra 
'--no-plugins' will not bad. And yes, I run selftest always with 
'--no-plugins' flag because bzrtools selftests fails on windows.
If you think that this flag is needless in tests I will not use it in 
future.

> I also find:
> 
> stdout, stderr = self.run_bzr('--no-plugins', 'status')
> easier to write, because you don't have to also provide [].

Yes. I think because this form is syntax sugar for new python2.4 
generators syntax (PEP289):

self.run_bzr('--no-plugins', 'status')

is equal to:

self.run_bzr(('--no-plugins', 'status'))

Lately I discover this fact: but this syntax incompatible with python2.3 
that I use in my embedded system project. So I try to be more explicit 
and use backward compatible syntax if I can.

--
Alexander




More information about the bazaar mailing list