~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2006-07-05 21:03:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1849.
  • Revision ID: jelmer@samba.org-20060705210358-9d755aa12b8f528d
Add more tests for create_repository().

Show diffs side-by-side

added added

removed removed

Lines of Context:
884
884
        made_repo = made_control.create_repository()
885
885
        self.failUnless(isinstance(made_repo, repository.Repository))
886
886
        self.assertEqual(made_control, made_repo.bzrdir)
 
887
 
 
888
    def test_create_repository_shared(self):
 
889
        # a bzrdir can create a shared repository or 
 
890
        # fail appropriately
 
891
        if not self.bzrdir_format.is_supported():
 
892
            # unsupported formats are not loopback testable
 
893
            # because the default open will not open them and
 
894
            # they may not be initializable.
 
895
            return
 
896
        t = get_transport(self.get_url())
 
897
        made_control = self.bzrdir_format.initialize(t.base)
 
898
        try:
 
899
            made_repo = made_control.create_repository(shared=True)
 
900
        except errors.IncompatibleFormat:
 
901
            # Old bzrdir formats don't support shared repositories
 
902
            # and should raise IncompatibleFormat
 
903
            return
 
904
        self.assertTrue(made_repo.is_shared())
 
905
 
 
906
    def test_create_repository_nonshared(self):
 
907
        # a bzrdir can create a non-shared repository 
 
908
        if not self.bzrdir_format.is_supported():
 
909
            # unsupported formats are not loopback testable
 
910
            # because the default open will not open them and
 
911
            # they may not be initializable.
 
912
            return
 
913
        t = get_transport(self.get_url())
 
914
        made_control = self.bzrdir_format.initialize(t.base)
 
915
        made_repo = made_control.create_repository(shared=False)
 
916
        self.assertFalse(made_repo.is_shared())
887
917
        
888
918
    def test_open_repository(self):
889
919
        if not self.bzrdir_format.is_supported():