~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-07-16 14:02:58 UTC
  • mfrom: (5346.2.3 doc)
  • Revision ID: pqm@pqm.ubuntu.com-20100716140258-js1p8i24w8nodz6t
(mbp) developer docs about transports and symlinks (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        self.assertIsDirectory('.bzr/branch/lock/held', t)
87
87
 
88
88
    def test_set_push_location(self):
89
 
        conf = config.LocationConfig.from_string('# comment\n', '.', save=True)
 
89
        from bzrlib.config import (locations_config_filename,
 
90
                                   ensure_config_dir_exists)
 
91
        ensure_config_dir_exists()
 
92
        fn = locations_config_filename()
 
93
        # write correct newlines to locations.conf
 
94
        # by default ConfigObj uses native line-endings for new files
 
95
        # but uses already existing line-endings if file is not empty
 
96
        f = open(fn, 'wb')
 
97
        try:
 
98
            f.write('# comment\n')
 
99
        finally:
 
100
            f.close()
90
101
 
91
102
        branch = self.make_branch('.', format='knit')
92
103
        branch.set_push_location('foo')
95
106
                             "[%s]\n"
96
107
                             "push_location = foo\n"
97
108
                             "push_location:policy = norecurse\n" % local_path,
98
 
                             config.locations_config_filename())
 
109
                             fn)
99
110
 
100
111
    # TODO RBC 20051029 test getting a push location from a branch in a
101
112
    # recursive section - that is, it appends the branch name.
541
552
        self.assertTrue(hasattr(params, 'bzrdir'))
542
553
        self.assertTrue(hasattr(params, 'branch'))
543
554
 
544
 
    def test_post_branch_init_hook_repr(self):
545
 
        param_reprs = []
546
 
        _mod_branch.Branch.hooks.install_named_hook('post_branch_init',
547
 
            lambda params: param_reprs.append(repr(params)), None)
548
 
        branch = self.make_branch('a')
549
 
        self.assertLength(1, param_reprs)
550
 
        param_repr = param_reprs[0]
551
 
        self.assertStartsWith(param_repr, '<BranchInitHookParams of ')
552
 
 
553
555
    def test_post_switch_hook(self):
554
556
        from bzrlib import switch
555
557
        calls = []