[MERGE][bug 94034] urllib http digest authentication

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Apr 26 07:20:12 BST 2007


>>>>> "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 ?

       Vincent



More information about the bazaar mailing list