~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_branch.py

  • Committer: Jonathan Riddell
  • Date: 2011-09-20 13:31:00 UTC
  • mto: This revision was merged to the branch mainline in revision 6153.
  • Revision ID: jriddell@canonical.com-20110920133100-kpsomvcnjoxv6n6b
syntax fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
        self.assertEqual(repo.get_signature_text('A'),
309
309
                         d2.open_repository().get_signature_text('A'))
310
310
 
311
 
    def test_nicks_bzr(self):
312
 
        """Test the behaviour of branch nicks specific to bzr branches.
 
311
    def test_nicks(self):
 
312
        """Test explicit and implicit branch nicknames.
313
313
 
314
314
        Nicknames are implicitly the name of the branch's directory, unless an
315
315
        explicit nickname is set.  That is, an explicit nickname always
316
316
        overrides the implicit one.
317
 
 
318
317
        """
319
318
        t = self.get_transport()
320
319
        branch = self.make_branch('bzr.dev')
321
 
        if not isinstance(branch, _mod_branch.BzrBranch):
322
 
            raise tests.TestNotApplicable("not a bzr branch format")
323
320
        # The nick will be 'bzr.dev', because there is no explicit nick set.
324
321
        self.assertEqual(branch.nick, 'bzr.dev')
325
322
        # Move the branch to a different directory, 'bzr.ab'.  Now that branch
341
338
        branch.nick = u"\u1234"
342
339
        self.assertEqual(branch.nick, u"\u1234")
343
340
 
344
 
    def test_nicks(self):
345
 
        """Test explicit and implicit branch nicknames.
346
 
 
347
 
        A nickname is always available, whether set explicitly or not.
348
 
        """
349
 
        t = self.get_transport()
350
 
        branch = self.make_branch('bzr.dev')
351
 
        # An implicit nick name is set; what it is exactly depends on the
352
 
        # format.
353
 
        self.assertIsInstance(branch.nick, basestring)
354
 
        # Set the branch nick explicitly.
355
 
        branch.nick = "Aaron's branch"
356
 
        # Because the nick has been set explicitly, the nick is now always
357
 
        # "Aaron's branch".
358
 
        self.assertEqual(branch.nick, "Aaron's branch")
359
 
        branch.nick = u"\u1234"
360
 
        self.assertEqual(branch.nick, u"\u1234")
361
 
 
362
341
    def test_commit_nicks(self):
363
342
        """Nicknames are committed to the revision"""
364
343
        wt = self.make_branch_and_tree('bzr.dev')
421
400
            return
422
401
        child_transport = repo.bzrdir.root_transport.clone('child')
423
402
        child_transport.mkdir('.')
424
 
        try:
425
 
            child_dir = self.bzrdir_format.initialize_on_transport(child_transport)
426
 
        except errors.UninitializableFormat:
427
 
            return
 
403
        child_dir = self.bzrdir_format.initialize_on_transport(child_transport)
428
404
        try:
429
405
            child_branch = self.branch_format.initialize(child_dir)
430
406
        except errors.UninitializableFormat:
561
537
            looked_up_format = registry.get(network_name)
562
538
            self.assertEqual(format.__class__, looked_up_format.__class__)
563
539
 
564
 
    def get_get_config_calls(self):
565
 
        # Smoke test that all branch succeed getting a config
566
 
        br = self.make_branch('.')
567
 
        br.get_config()
568
 
        br.get_config_stack()
569
 
 
570
540
 
571
541
class ChrootedTests(per_branch.TestCaseWithBranch):
572
542
    """A support class that provides readonly urls outside the local namespace.
1100
1070
 
1101
1071
class TestBranchControlComponent(per_branch.TestCaseWithBranch):
1102
1072
    """Branch implementations adequately implement ControlComponent."""
1103
 
 
 
1073
    
1104
1074
    def test_urls(self):
1105
1075
        br = self.make_branch('branch')
1106
1076
        self.assertIsInstance(br.user_url, str)