Rev 4489: (vila) Cleanup imports in some test files in http://bazaar.launchpad.net/%7Evila/bzr/integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 29 13:14:15 BST 2009


At http://bazaar.launchpad.net/%7Evila/bzr/integration

------------------------------------------------------------
revno: 4489
revision-id: v.ladeuil+lp at free.fr-20090629121409-0ime74unkuaodwyj
parent: pqm at pqm.ubuntu.com-20090627002953-q4333x7hfvw1q3wz
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration
timestamp: Mon 2009-06-29 14:14:09 +0200
message:
  (vila) Cleanup imports in some test files
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2009-06-10 03:56:49 +0000
+++ b/bzrlib/tests/test_config.py	2009-06-29 12:14:09 +0000
@@ -18,7 +18,6 @@
 """Tests for finding and reading the bzr config file[s]."""
 # import system imports here
 from cStringIO import StringIO
-import getpass
 import os
 import sys
 

=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py	2009-06-17 05:16:48 +0000
+++ b/bzrlib/tests/test_ui.py	2009-06-29 12:14:09 +0000
@@ -23,21 +23,15 @@
 import sys
 import time
 
-import bzrlib
-import bzrlib.errors as errors
+from bzrlib import (
+    errors,
+    tests,
+    ui as _mod_ui,
+    )
 from bzrlib.symbol_versioning import (
     deprecated_in,
     )
-from bzrlib.tests import (
-    TestCase,
-    TestUIFactory,
-    StringIOWrapper,
-    )
 from bzrlib.tests.test_progress import _TTYStringIO
-from bzrlib.ui import (
-    CLIUIFactory,
-    SilentUIFactory,
-    )
 from bzrlib.ui.text import (
     NullProgressView,
     TextProgressView,
@@ -45,10 +39,10 @@
     )
 
 
-class UITests(TestCase):
+class UITests(tests.TestCase):
 
     def test_silent_factory(self):
-        ui = SilentUIFactory()
+        ui = _mod_ui.SilentUIFactory()
         stdout = StringIO()
         self.assertEqual(None,
                          self.apply_redirected(None, stdout, stdout,
@@ -62,8 +56,9 @@
         self.assertEqual('', stdout.getvalue())
 
     def test_text_factory_ascii_password(self):
-        ui = TestUIFactory(stdin='secret\n', stdout=StringIOWrapper(),
-                           stderr=StringIOWrapper())
+        ui = tests.TestUIFactory(stdin='secret\n',
+                                 stdout=tests.StringIOWrapper(),
+                                 stderr=tests.StringIOWrapper())
         pb = ui.nested_progress_bar()
         try:
             self.assertEqual('secret',
@@ -84,9 +79,9 @@
         We can't predict what encoding users will have for stdin, so we force
         it to utf8 to test that we transport the password correctly.
         """
-        ui = TestUIFactory(stdin=u'baz\u1234'.encode('utf8'),
-                           stdout=StringIOWrapper(),
-                           stderr=StringIOWrapper())
+        ui = tests.TestUIFactory(stdin=u'baz\u1234'.encode('utf8'),
+                                 stdout=tests.StringIOWrapper(),
+                                 stderr=tests.StringIOWrapper())
         ui.stderr.encoding = ui.stdout.encoding = ui.stdin.encoding = 'utf8'
         pb = ui.nested_progress_bar()
         try:
@@ -194,11 +189,11 @@
         self.assertEqual('', factory.stdin.readline())
 
     def test_silent_ui_getbool(self):
-        factory = SilentUIFactory()
+        factory = _mod_ui.SilentUIFactory()
         self.assert_get_bool_acceptance_of_user_input(factory)
 
     def test_silent_factory_prompts_silently(self):
-        factory = SilentUIFactory()
+        factory = _mod_ui.SilentUIFactory()
         stdout = StringIO()
         factory.stdin = StringIO("y\n")
         self.assertEqual(True,
@@ -222,7 +217,8 @@
     def test_text_factory_prompts_and_clears(self):
         # a get_boolean call should clear the pb before prompting
         out = _TTYStringIO()
-        factory = TextUIFactory(stdin=StringIO("yada\ny\n"), stdout=out, stderr=out)
+        factory = TextUIFactory(stdin=StringIO("yada\ny\n"),
+                                stdout=out, stderr=out)
         pb = factory.nested_progress_bar()
         pb.show_bar = False
         pb.show_spinner = False
@@ -253,7 +249,7 @@
             pb.finished()
 
     def test_silent_ui_getusername(self):
-        factory = SilentUIFactory()
+        factory = _mod_ui.SilentUIFactory()
         factory.stdin = StringIO("someuser\n\n")
         factory.stdout = StringIO()
         factory.stderr = StringIO()
@@ -279,8 +275,9 @@
         self.assertEqual('', factory.stdin.readline())
 
     def test_text_ui_getusername_utf8(self):
-        ui = TestUIFactory(stdin=u'someuser\u1234'.encode('utf8'),
-                           stdout=StringIOWrapper(), stderr=StringIOWrapper())
+        ui = tests.TestUIFactory(stdin=u'someuser\u1234'.encode('utf8'),
+                                 stdout=tests.StringIOWrapper(),
+                                 stderr=tests.StringIOWrapper())
         ui.stderr.encoding = ui.stdout.encoding = ui.stdin.encoding = "utf8"
         pb = ui.nested_progress_bar()
         try:
@@ -295,7 +292,7 @@
             pb.finished()
 
 
-class TestTextProgressView(TestCase):
+class TestTextProgressView(tests.TestCase):
     """Tests for text display of progress bars.
     """
     # XXX: These might be a bit easier to write if the rendering and



More information about the bazaar-commits mailing list