~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Gordon Tyler
  • Date: 2010-02-25 13:15:08 UTC
  • mto: This revision was merged to the branch mainline in revision 5070.
  • Revision ID: gordon@doxxx.net-20100225131508-2ntxutul7ibo92wa
Improved test_show_error to check kwargs, dict substitution and exception handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    )
37
37
import bzrlib.branch
38
38
from bzrlib.errors import (NotBranchError,
39
 
                           NoColocatedBranchSupport,
40
39
                           UnknownFormatError,
41
40
                           UnsupportedFormatError,
42
41
                           )
207
206
        """See BzrDir.open_repository."""
208
207
        return SampleRepository(self)
209
208
 
210
 
    def create_branch(self, name=None):
 
209
    def create_branch(self):
211
210
        """See BzrDir.create_branch."""
212
 
        if name is not None:
213
 
            raise NoColocatedBranchSupport(self)
214
211
        return SampleBranch(self)
215
212
 
216
213
    def create_workingtree(self):
471
468
        # Make stackable source branch with an unstackable repo format.
472
469
        source_bzrdir = self.make_bzrdir('source')
473
470
        pack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
474
 
        source_branch = bzrlib.branch.BzrBranchFormat7().initialize(
475
 
            source_bzrdir)
 
471
        source_branch = bzrlib.branch.BzrBranchFormat7().initialize(source_bzrdir)
476
472
        # Make a directory with a default stacking policy
477
473
        parent_bzrdir = self.make_bzrdir('parent')
478
474
        stacked_on = self.make_branch('parent/stacked-on', format='pack-0.92')
1339
1335
        url = transport.base
1340
1336
        err = self.assertRaises(errors.BzrError, bzrdir.BzrDir.open, url)
1341
1337
        self.assertEqual('fail', err._preformatted_string)
1342
 
 
1343
 
    def test_post_repo_init(self):
1344
 
        from bzrlib.bzrdir import RepoInitHookParams
1345
 
        calls = []
1346
 
        bzrdir.BzrDir.hooks.install_named_hook('post_repo_init',
1347
 
            calls.append, None)
1348
 
        self.make_repository('foo')
1349
 
        self.assertLength(1, calls)
1350
 
        params = calls[0]
1351
 
        self.assertIsInstance(params, RepoInitHookParams)
1352
 
        self.assertTrue(hasattr(params, 'bzrdir'))
1353
 
        self.assertTrue(hasattr(params, 'repository'))