~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

Branch now uses BzrDir reasonably sanely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
class TestDefaultFormat(TestCase):
37
37
 
38
 
    def test_get_set_default_initializer(self):
 
38
    def test_get_set_default_format(self):
39
39
        old_format = bzrdir.BzrDirFormat.get_default_format()
40
40
        # default is BzrDirFormat6
41
41
        self.failUnless(isinstance(old_format, bzrdir.BzrDirFormat6))
56
56
        """See BzrDir.create_repository."""
57
57
        return "A repository"
58
58
 
 
59
    def create_branch(self):
 
60
        """See BzrDir.create_branch."""
 
61
        return "A branch"
 
62
 
59
63
 
60
64
class SampleBzrDirFormat(bzrdir.BzrDirFormat):
61
65
    """A sample format
78
82
    def is_supported(self):
79
83
        return False
80
84
 
81
 
    def open(self, transport):
 
85
    def open(self, transport, _found=None):
82
86
        return "opened branch."
83
87
 
84
88
 
138
142
            self.assertEqual('A repository', repo)
139
143
        finally:
140
144
            bzrdir.BzrDirFormat.set_default_format(old_format)
141
 
        
 
145
 
 
146
    def test_create_branch(self):
 
147
        format = SampleBzrDirFormat()
 
148
        old_format = bzrdir.BzrDirFormat.get_default_format()
 
149
        bzrdir.BzrDirFormat.set_default_format(format)
 
150
        try:
 
151
            repo = bzrdir.BzrDir.create_branch_and_repo(self.get_url())
 
152
            self.assertEqual('A branch', repo)
 
153
        finally:
 
154
            bzrdir.BzrDirFormat.set_default_format(old_format)
 
155
 
142
156
 
143
157
class ChrootedTests(TestCaseWithTransport):
144
158
    """A support class that provides readonly urls outside the local namespace.