[MERGE][bug 94034] urllib http digest authentication

Alexander Belchenko bialix at ukr.net
Thu Apr 26 07:49:06 BST 2007


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

Vincent Ladeuil пишет:
>>>>>> "Martin" == Martin Pool <mbp at sourcefrog.net> writes:
> 
>     Martin> Unfortunately this fails at the moment in get_password, as shown below:
> 
> Doh !
> 
> I can't reproduce that on neither:
> 
> - Feisty with python2.5,
> - Edgy with python2.4,
> - OS X with python2.5.
> 
> What is even more surprising is that there are other tests that
> use get_password in test_ui and they don't seem to fail >-/
> 
> <snip/>
> 
>     Martin> File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/ui/__init__.py",
>     Martin> line 147, in get_password
> 
>     Martin>   prompt = (prompt % kwargs).encode(sys.stdout.encoding, 'replace')
> 
>     Martin> TypeError: encode() argument 1 must be string, not None
> 
> sys.stdout.encoding is None ? Wth ?
> 
> class TestAuth(object):
> 
> ...
> 
>     def test_prompt_for_password(self):
>         self.server.add_user('joe', 'foo')
>         t = self.get_user_transport('joe', None)
>         ui.ui_factory = TestUIFactory(stdin='foo\n', stdout=StringIOWrapper())
> 
> I explicitly use a StringIOWrapper to provide an 'encoding' attribute 8-/
> 
> class UITests(TestCase):
> 
> ...
> 
>     def test_text_factory_ascii_password(self):
>         ui = TestUIFactory(stdin='secret\n', stdout=StringIOWrapper())
>         pb = ui.nested_progress_bar()
>         try:
>             self.assertEqual('secret',
>                              self.apply_redirected(ui.stdin, ui.stdout,
>                                                    ui.stdout,
>                                                    ui.get_password))
> 
> Same here, how one can fail and not the other ?
> 
> Any chance you can give me more info on that bug ?
> 
> What class is stdout at failure time ? 
> What os/python/whatever is making that test fail ?
> Can you reproduce it yourself ?

Probably you need simply redirect both stdout and stderr to files
to obtain the same behavior. Just a thoughts.

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGMEtizYr338mxwCURArT5AJ4n5DnN4UKYIGq7xFkNd7/yDjtQoQCdF4kb
gtroSopQ2imvK/TOB+RnAT4=
=Mvwn
-----END PGP SIGNATURE-----



More information about the bazaar mailing list