Rev 2440: Fix test failure on pqm. in http://bazaar.launchpad.net/~bzr/bzr/bzr.http.auth

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Apr 26 08:21:27 BST 2007


At http://bazaar.launchpad.net/~bzr/bzr/bzr.http.auth

------------------------------------------------------------
revno: 2440
revision-id: v.ladeuil+lp at free.fr-20070426072124-bty9pn2i122u1zpx
parent: v.ladeuil+lp at free.fr-20070424100523-3odqlqm2nnoc8gdu
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bzr.http.auth
timestamp: Thu 2007-04-26 09:21:24 +0200
message:
  Fix test failure on pqm.
  
  * bzrlib/tests/test_http.py:
  (TestAuth.setUp): Overrides sys.stdout, TestUIFactory will not do
  it for us and the tests fail on pqm otherwise.
  (TestAuth.test_prompt_for_password): No need to provide stdout
  parameter anymore.
modified:
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
-------------- next part --------------
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2007-04-22 16:32:04 +0000
+++ b/bzrlib/tests/test_http.py	2007-04-26 07:21:24 +0000
@@ -24,6 +24,7 @@
 import os
 import select
 import socket
+import sys
 import threading
 
 import bzrlib
@@ -1154,10 +1155,13 @@
         self.build_tree_contents([('a', 'contents of a\n'),
                                   ('b', 'contents of b\n'),])
         self.old_factory = ui.ui_factory
+        self.old_stdout = sys.stdout
+        sys.stdout = StringIOWrapper()
         self.addCleanup(self.restoreUIFactory)
 
     def restoreUIFactory(self):
         ui.ui_factory = self.old_factory
+        sys.stdout = self.old_stdout
 
     def get_user_url(self, user=None, password=None):
         """Build an url embedding user and password"""
@@ -1211,7 +1215,7 @@
     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())
+        ui.ui_factory = TestUIFactory(stdin='foo\n')
         self.assertEqual('contents of a\n',t.get('a').read())
         # stdin should be empty
         self.assertEqual('', ui.ui_factory.stdin.readline())



More information about the bazaar-commits mailing list