Rev 5028: Fix imports in per_branch/test_push.py. in file:///home/vila/src/bzr/cleanup/test-imports/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Feb 8 09:02:01 GMT 2010


At file:///home/vila/src/bzr/cleanup/test-imports/

------------------------------------------------------------
revno: 5028
revision-id: v.ladeuil+lp at free.fr-20100208090201-ds6ldvwxfeud7jdo
parent: v.ladeuil+lp at free.fr-20100208085509-s6rrgjelnwmd3nzw
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: test-imports
timestamp: Mon 2010-02-08 10:02:01 +0100
message:
  Fix imports in per_branch/test_push.py.
-------------- next part --------------
=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py	2010-01-25 17:48:22 +0000
+++ b/bzrlib/tests/per_branch/test_push.py	2010-02-08 09:02:01 +0000
@@ -26,22 +26,23 @@
     check,
     debug,
     errors,
+    memorytree,
     push,
     repository,
+    revision,
     tests,
-    )
-from bzrlib.branch import Branch
-from bzrlib.bzrdir import BzrDir
-from bzrlib.memorytree import MemoryTree
-from bzrlib.revision import NULL_REVISION
-from bzrlib.smart import client, server
-from bzrlib.smart.repository import SmartServerRepositoryGetParentMap
-from bzrlib.tests.per_branch.test_branch import TestCaseWithBranch
-from bzrlib.transport import get_transport
-from bzrlib.transport.local import LocalURLServer
-
-
-class TestPush(TestCaseWithBranch):
+    transport,
+    )
+from bzrlib.smart import (
+    client,
+    server,
+    repository as _mod_smart_repo,
+    )
+from bzrlib.tests import per_branch
+from bzrlib.transport import local
+
+
+class TestPush(per_branch.TestCaseWithBranch):
 
     def test_push_convergence_simple(self):
         # when revisions are pushed, the left-most accessible parents must
@@ -148,10 +149,11 @@
         try:
             tree = a_branch.bzrdir.create_workingtree()
         except errors.NotLocalUrl:
-            if self.vfs_transport_factory is LocalURLServer:
+            if self.vfs_transport_factory is local.LocalURLServer:
                 # the branch is colocated on disk, we cannot create a checkout.
                 # hopefully callers will expect this.
-                local_controldir= bzrdir.BzrDir.open(self.get_vfs_only_url('repo/tree'))
+                local_controldir= bzrdir.BzrDir.open(
+                    self.get_vfs_only_url('repo/tree'))
                 tree = local_controldir.create_workingtree()
             else:
                 tree = a_branch.create_checkout('repo/tree', lightweight=True)
@@ -223,7 +225,7 @@
         push._show_push_branch(trunk, 'rev-2', self.get_url('remote'), output)
         # Push rev-3 onto "remote".  If "remote" not stacked and is missing the
         # fulltext record for f-id @ rev-1, then this will fail.
-        remote_branch = Branch.open(self.get_url('remote'))
+        remote_branch = branch.Branch.open(self.get_url('remote'))
         trunk.push(remote_branch)
         check.check_dwim(remote_branch.base, False, True, True)
 
@@ -277,15 +279,15 @@
         # for or receiving more data than the caller asked for.
         self.overrideAttr(repository.InterRepository,
                           '_walk_to_common_revisions_batch_size', 1)
-        self.overrideAttr(SmartServerRepositoryGetParentMap,
+        self.overrideAttr(_mod_smart_repo.SmartServerRepositoryGetParentMap,
                           'no_extra_results', True)
 
 
-class TestPushHook(TestCaseWithBranch):
+class TestPushHook(per_branch.TestCaseWithBranch):
 
     def setUp(self):
         self.hook_calls = []
-        TestCaseWithBranch.setUp(self)
+        super(TestPushHook, self).setUp()
 
     def capture_post_push_hook(self, result):
         """Capture post push hook calls to self.hook_calls.
@@ -309,14 +311,14 @@
     def test_post_push_empty_history(self):
         target = self.make_branch('target')
         source = self.make_branch('source')
-        Branch.hooks.install_named_hook('post_push',
-                                        self.capture_post_push_hook, None)
+        branch.Branch.hooks.install_named_hook(
+            'post_push', self.capture_post_push_hook, None)
         source.push(target)
         # with nothing there we should still get a notification, and
         # have both branches locked at the notification time.
         self.assertEqual([
-            ('post_push', source, None, target.base, 0, NULL_REVISION,
-             0, NULL_REVISION, True, None, True)
+            ('post_push', source, None, target.base, 0, revision.NULL_REVISION,
+             0, revision.NULL_REVISION, True, None, True)
             ],
             self.hook_calls)
 
@@ -335,17 +337,18 @@
             # remotebranches can't be bound.  Let's instead make a new local
             # branch of the default type, which does allow binding.
             # See https://bugs.launchpad.net/bzr/+bug/112020
-            local = BzrDir.create_branch_convenience('local2')
+            local = bzrdir.BzrDir.create_branch_convenience('local2')
             local.bind(target)
         source = self.make_branch('source')
-        Branch.hooks.install_named_hook('post_push',
-                                        self.capture_post_push_hook, None)
+        branch.Branch.hooks.install_named_hook(
+            'post_push', self.capture_post_push_hook, None)
         source.push(local)
         # with nothing there we should still get a notification, and
         # have both branches locked at the notification time.
         self.assertEqual([
-            ('post_push', source, local.base, target.base, 0, NULL_REVISION,
-             0, NULL_REVISION, True, True, True)
+            ('post_push', source, local.base, target.base, 0,
+             revision.NULL_REVISION, 0, revision.NULL_REVISION,
+             True, True, True)
             ],
             self.hook_calls)
 
@@ -356,10 +359,10 @@
         rev1 = target.commit('rev 1')
         target.unlock()
         sourcedir = target.bzrdir.clone(self.get_url('source'))
-        source = MemoryTree.create_on_branch(sourcedir.open_branch())
+        source = memorytree.MemoryTree.create_on_branch(sourcedir.open_branch())
         rev2 = source.commit('rev 2')
-        Branch.hooks.install_named_hook('post_push',
-                                        self.capture_post_push_hook, None)
+        branch.Branch.hooks.install_named_hook(
+            'post_push', self.capture_post_push_hook, None)
         source.branch.push(target.branch)
         # with nothing there we should still get a notification, and
         # have both branches locked at the notification time.
@@ -370,7 +373,7 @@
             self.hook_calls)
 
 
-class EmptyPushSmartEffortTests(TestCaseWithBranch):
+class EmptyPushSmartEffortTests(per_branch.TestCaseWithBranch):
     """Tests that a push of 0 revisions should make a limited number of smart
     protocol RPCs.
     """
@@ -404,8 +407,8 @@
     def test_empty_branch_api(self):
         """The branch_obj.push API should make a limited number of HPSS calls.
         """
-        transport = get_transport(self.smart_server.get_url()).clone('target')
-        target = Branch.open_from_transport(transport)
+        t = transport.get_transport(self.smart_server.get_url()).clone('target')
+        target = branch.Branch.open_from_transport(t)
         self.empty_branch.push(target)
         self.assertEqual(
             ['BzrDir.open_2.1',
@@ -432,11 +435,11 @@
         self.assertTrue(len(self.hpss_calls) <= 9, self.hpss_calls)
 
 
-class TestLossyPush(TestCaseWithBranch):
+class TestLossyPush(per_branch.TestCaseWithBranch):
 
     def setUp(self):
         self.hook_calls = []
-        TestCaseWithBranch.setUp(self)
+        super(TestLossyPush, self).setUp()
 
     def test_lossy_push_raises_same_vcs(self):
         target = self.make_branch('target')



More information about the bazaar-commits mailing list