Rev 4725: Cleanup some more dpush related tests in http://bazaar.launchpad.net/~vila/bzr/integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Oct 2 10:26:07 BST 2009


At http://bazaar.launchpad.net/~vila/bzr/integration

------------------------------------------------------------
revno: 4725
revision-id: v.ladeuil+lp at free.fr-20091002092601-exp6mavixuyt9fch
parent: v.ladeuil+lp at free.fr-20091002092522-zbn63nvrwnzen4ed
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration
timestamp: Fri 2009-10-02 11:26:01 +0200
message:
  Cleanup some more dpush related tests
-------------- next part --------------
=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py	2009-08-17 07:54:34 +0000
+++ b/bzrlib/tests/test_foreign.py	2009-10-02 09:26:01 +0000
@@ -20,24 +20,15 @@
 
 from bzrlib import (
     branch,
+    bzrdir,
     errors,
     foreign,
     lockable_files,
     lockdir,
+    revision,
+    tests,
     trace,
     )
-from bzrlib.bzrdir import (
-    BzrDir,
-    BzrDirFormat,
-    BzrDirMeta1,
-    BzrDirMetaFormat1,
-    format_registry,
-    )
-from bzrlib.inventory import Inventory
-from bzrlib.revision import (
-    NULL_REVISION,
-    Revision,
-    )
 from bzrlib.tests import (
     TestCase,
     TestCaseWithTransport,
@@ -136,7 +127,7 @@
                     (str(rev.timestamp), str(rev.timezone), 
                         str(self.target.revno())))
                 parent_revno, parent_revid= self.target.last_revision_info()
-                if parent_revid == NULL_REVISION:
+                if parent_revid == revision.NULL_REVISION:
                     parent_revids = []
                 else:
                     parent_revids = [parent_revid]
@@ -192,7 +183,7 @@
             raise errors.NotBranchError(path=transport.base)
 
 
-class DummyForeignVcsDirFormat(BzrDirMetaFormat1):
+class DummyForeignVcsDirFormat(bzrdir.BzrDirMetaFormat1):
     """BzrDirFormat for the dummy foreign VCS."""
 
     @classmethod
@@ -239,7 +230,7 @@
         return DummyForeignVcsDir(transport, self)
 
 
-class DummyForeignVcsDir(BzrDirMeta1):
+class DummyForeignVcsDir(bzrdir.BzrDirMeta1):
 
     def __init__(self, _transport, _format):
         self._format = _format
@@ -254,7 +245,7 @@
 
     def cloning_metadir(self, stacked=False):
         """Produce a metadir suitable for cloning with."""
-        return format_registry.make_bzrdir("default")
+        return bzrdir.format_registry.make_bzrdir("default")
 
     def sprout(self, url, revision_id=None, force_new_repo=False,
                recurse='down', possible_transports=None,
@@ -268,7 +259,7 @@
                 hardlink=hardlink, stacked=stacked, source_branch=source_branch)
 
 
-class ForeignVcsRegistryTests(TestCase):
+class ForeignVcsRegistryTests(tests.TestCase):
     """Tests for the ForeignVcsRegistry class."""
 
     def test_parse_revision_id_no_dash(self):
@@ -289,7 +280,7 @@
                           reg.parse_revision_id("dummy-v1:some-foreign-revid"))
 
 
-class ForeignRevisionTests(TestCase):
+class ForeignRevisionTests(tests.TestCase):
     """Tests for the ForeignRevision class."""
 
     def test_create(self):
@@ -325,18 +316,19 @@
             wt.unlock()
 
 
-class DummyForeignVcsTests(TestCaseWithTransport):
+class DummyForeignVcsTests(tests.TestCaseWithTransport):
     """Very basic test for DummyForeignVcs."""
 
     def setUp(self):
-        BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
+        bzrdir.BzrDirFormat.register_control_format(DummyForeignVcsDirFormat)
         branch.InterBranch.register_optimiser(InterToDummyVcsBranch)
         self.addCleanup(self.unregister)
         super(DummyForeignVcsTests, self).setUp()
 
     def unregister(self):
         try:
-            BzrDirFormat.unregister_control_format(DummyForeignVcsDirFormat)
+            bzrdir.BzrDirFormat.unregister_control_format(
+                DummyForeignVcsDirFormat)
         except ValueError:
             pass
         branch.InterBranch.unregister_optimiser(InterToDummyVcsBranch)
@@ -344,7 +336,7 @@
     def test_create(self):
         """Test we can create dummies."""
         self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
-        dir = BzrDir.open("d")
+        dir = bzrdir.BzrDir.open("d")
         self.assertEquals("A Dummy VCS Dir", dir._format.get_format_string())
         dir.open_repository()
         dir.open_branch()
@@ -353,17 +345,18 @@
     def test_sprout(self):
         """Test we can clone dummies and that the format is not preserved."""
         self.make_branch_and_tree("d", format=DummyForeignVcsDirFormat())
-        dir = BzrDir.open("d")
+        dir = bzrdir.BzrDir.open("d")
         newdir = dir.sprout("e")
-        self.assertNotEquals("A Dummy VCS Dir", newdir._format.get_format_string())
+        self.assertNotEquals("A Dummy VCS Dir",
+                             newdir._format.get_format_string())
 
     def test_lossy_push_empty(self):
         source_tree = self.make_branch_and_tree("source")
         target_tree = self.make_branch_and_tree("target", 
             format=DummyForeignVcsDirFormat())
         pushresult = source_tree.branch.lossy_push(target_tree.branch)
-        self.assertEquals(NULL_REVISION, pushresult.old_revid)
-        self.assertEquals(NULL_REVISION, pushresult.new_revid)
+        self.assertEquals(revision.NULL_REVISION, pushresult.old_revid)
+        self.assertEquals(revision.NULL_REVISION, pushresult.new_revid)
         self.assertEquals({}, pushresult.revidmap)
 
     def test_lossy_push_simple(self):
@@ -378,7 +371,7 @@
             pushresult = source_tree.branch.lossy_push(target_tree.branch)
         finally:
             target_tree.branch.unlock()
-        self.assertEquals(NULL_REVISION, pushresult.old_revid)
+        self.assertEquals(revision.NULL_REVISION, pushresult.old_revid)
         self.assertEquals({revid1:target_tree.branch.last_revision()}, 
                            pushresult.revidmap)
         self.assertEquals(pushresult.revidmap[revid1], pushresult.new_revid)



More information about the bazaar-commits mailing list