~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: 2011-02-03 02:22:57 UTC
  • mfrom: (5639.1.2 doc-lint-2.4)
  • Revision ID: pqm@pqm.ubuntu.com-20110203022257-caoghu6higq98tak
(spiv) Link to What's New in 2.4 (rather than 2.3) in doc index,
 and add missing comma in doc. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
        return "opened supported branch."
148
148
 
149
149
 
150
 
class SampleExtraBranchFormat(_mod_branch.BranchFormat):
151
 
    """A sample format that is not usable in a metadir."""
152
 
 
153
 
    def get_format_string(self):
154
 
        # This format is not usable in a metadir.
155
 
        return None
156
 
 
157
 
    def network_name(self):
158
 
        # Network name always has to be provided.
159
 
        return "extra"
160
 
 
161
 
    def initialize(self, a_bzrdir, name=None):
162
 
        raise NotImplementedError(self.initialize)
163
 
 
164
 
    def open(self, transport, name=None, _found=False, ignore_fallbacks=False):
165
 
        raise NotImplementedError(self.open)
166
 
 
167
 
 
168
150
class TestBzrBranchFormat(tests.TestCaseWithTransport):
169
151
    """Tests for the BzrBranchFormat facility."""
170
152
 
181
163
            self.failUnless(isinstance(found_format, format.__class__))
182
164
        check_format(_mod_branch.BzrBranchFormat5(), "bar")
183
165
 
184
 
    def test_extra_format(self):
185
 
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
186
 
        SampleSupportedBranchFormat().initialize(dir)
187
 
        format = SampleExtraBranchFormat()
188
 
        _mod_branch.BranchFormat.register_extra_format(format)
189
 
        self.addCleanup(_mod_branch.BranchFormat.unregister_extra_format,
190
 
            format)
191
 
        self.assertTrue(format in _mod_branch.BranchFormat.get_formats())
192
 
        self.assertEquals(format,
193
 
            _mod_branch.network_format_registry.get("extra"))
194
 
 
195
166
    def test_find_format_factory(self):
196
167
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
197
168
        SampleSupportedBranchFormat().initialize(dir)