Rev 2480: Add tests. in file:///v/home/vila/src/bugs/111702/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed May 2 21:31:03 BST 2007


At file:///v/home/vila/src/bugs/111702/

------------------------------------------------------------
revno: 2480
revision-id: v.ladeuil+lp at free.fr-20070502203101-prcuwowzkz5qh0gn
parent: v.ladeuil+lp at free.fr-20070502201837-od1q12zbvr90kyni
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 111702
timestamp: Wed 2007-05-02 22:31:01 +0200
message:
  Add tests.
  
  * tests/test_bzrdir.py: 
  (TestBzrDirFormat): Add tests for the new parameters.
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2007-05-02 20:18:37 +0000
+++ b/bzrlib/bzrdir.py	2007-05-02 20:31:01 +0000
@@ -270,9 +270,8 @@
 
     @staticmethod
     def create_branch_convenience(base=None, transport=None,
-                                  force_new_repo=False,
-                                  force_new_tree=None, format=None,
-                                  ):
+                                  force_new_repo=False, force_new_tree=None,
+                                  format=None):
         """Create a new BzrDir, Branch and Repository at the url 'base'.
 
         This is a convenience function - it will use an existing repository
@@ -315,14 +314,14 @@
             bzrdir = format.initialize_on_transport(transport)
         repo = bzrdir._find_or_create_repository(force_new_repo)
         result = bzrdir.create_branch()
-        if force_new_tree or (repo.make_working_trees() and 
+        if force_new_tree or (repo.make_working_trees() and
                               force_new_tree is None):
             try:
                 bzrdir.create_workingtree()
             except errors.NotLocalUrl:
                 pass
         return result
-        
+
     @staticmethod
     def create_repository(base, shared=False, format=None):
         """Create a new BzrDir and Repository at the url 'base'.

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2007-04-05 09:35:26 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2007-05-02 20:31:01 +0000
@@ -336,6 +336,11 @@
             format=format)
         tree.bzrdir.open_repository()
 
+    def test_create_branch_convenience_mising_parameter(self):
+        # at least one of base or transport should be provided
+        self.assertRaises(AssertionError,
+                          bzrdir.BzrDir.create_branch_convenience)
+
     def test_create_branch_convenience(self):
         # outside a repo the default convenience output is a repo+branch_tree
         format = bzrdir.format_registry.make_bzrdir('knit')
@@ -343,6 +348,15 @@
         branch.bzrdir.open_workingtree()
         branch.bzrdir.open_repository()
 
+    def test_create_branch_convenience_with_transport(self):
+        t = get_transport(self.get_url())
+        # outside a repo the default convenience output is a repo+branch_tree
+        format = bzrdir.format_registry.make_bzrdir('knit')
+        branch = bzrdir.BzrDir.create_branch_convenience(transport=t,
+                                                         format=format)
+        branch.bzrdir.open_workingtree()
+        branch.bzrdir.open_repository()
+
     def test_create_branch_convenience_root(self):
         """Creating a branch at the root of a fs should work."""
         self.vfs_transport_factory = MemoryServer



More information about the bazaar-commits mailing list