Rev 2186: Unbreak TestRepositoryMakeBranchAndTree. in http://bazaar.launchpad.net/~bzr/bzr/hpss

Robert Collins robertc at robertcollins.net
Thu Mar 29 03:33:26 BST 2007


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

------------------------------------------------------------
revno: 2186
revision-id: robertc at robertcollins.net-20070329023227-1xss7o4d3bc56x8h
parent: robertc at robertcollins.net-20070329021404-5fcofqw7m3znip04
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss
timestamp: Thu 2007-03-29 12:32:27 +1000
message:
  Unbreak TestRepositoryMakeBranchAndTree.
modified:
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-03-29 02:14:04 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-03-29 02:32:27 +0000
@@ -49,30 +49,23 @@
 
 class TestCaseWithRepository(TestCaseWithBzrDir):
 
-    def XXXmake_branch(self, relpath, format=None):
-        repo = self.make_repository(relpath, format=None)
-        return repo.bzrdir.create_branch()
-
-    def XXXmake_repository(self, relpath, format=None):
-        made_control = self.make_bzrdir(relpath)
-        return self.repository_format.initialize(made_control)
-
-    def XXXmake_branch_and_tree(self, relpath):
-        branch = self.make_branch(relpath)
-        try:
-            branch.bzrdir.root_transport.local_abspath('.')
-        except errors.TransportNotPossible:
-            # we want callers of this function to see a RemoteRepository at
-            # tree.branch.repository
-            return branch.create_checkout(relpath, lightweight=True)
+    def make_repository(self, relpath, format=None):
+        if format is None:
+            # Create a repository of the type we are trying to test.
+            made_control = self.make_bzrdir(relpath)
+            return self.repository_format.initialize(made_control)
         else:
-            return branch.bzrdir.create_workingtree()
+            return super(TestCaseWithRepository, self).make_repository(
+                relpath, format)
 
 
 class TestRepositoryMakeBranchAndTree(TestCaseWithRepository):
 
     def test_repository_format(self):
-        # make sure the repository on tree.branch is of the desired format
+        # make sure the repository on tree.branch is of the desired format,
+        # because developers use this api to setup the tree, branch and 
+        # repository for their tests: having it now give the right repository
+        # type would invalidate the tests.
         tree = self.make_branch_and_tree('repo')
         self.assertIsInstance(tree.branch.repository._format,
             self.repository_format.__class__)



More information about the bazaar-commits mailing list