~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.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:
123
123
        return "opened tree."
124
124
 
125
125
 
126
 
class SampleExtraTreeFormat(workingtree.WorkingTreeFormat):
127
 
    """A sample format that does not support use in a metadir.
128
 
 
129
 
    """
130
 
 
131
 
    def get_format_string(self):
132
 
        # Not usable in a metadir, so no format string
133
 
        return None
134
 
 
135
 
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
136
 
                   accelerator_tree=None, hardlink=False):
137
 
        raise NotImplementedError(self.initialize)
138
 
 
139
 
    def is_supported(self):
140
 
        return False
141
 
 
142
 
    def open(self, transport, _found=False):
143
 
        raise NotImplementedError(self.open)
144
 
 
145
 
 
146
126
class TestWorkingTreeFormat(TestCaseWithTransport):
147
127
    """Tests for the WorkingTreeFormat facility."""
148
128
 
185
165
        format.initialize(dir)
186
166
        # register a format for it.
187
167
        workingtree.WorkingTreeFormat.register_format(format)
188
 
        self.assertTrue(format in workingtree.WorkingTreeFormat.get_formats())
189
168
        # which branch.Open will refuse (not supported)
190
169
        self.assertRaises(errors.UnsupportedFormatError, workingtree.WorkingTree.open, '.')
191
170
        # but open_downlevel will work
192
171
        self.assertEqual(format.open(dir), workingtree.WorkingTree.open_downlevel('.'))
193
172
        # unregister the format
194
173
        workingtree.WorkingTreeFormat.unregister_format(format)
195
 
        self.assertFalse(format in workingtree.WorkingTreeFormat.get_formats())
196
 
 
197
 
    def test_register_unregister_extra_format(self):
198
 
        format = SampleExtraTreeFormat()
199
 
        workingtree.WorkingTreeFormat.register_extra_format(format)
200
 
        self.assertTrue(format in workingtree.WorkingTreeFormat.get_formats())
201
 
        workingtree.WorkingTreeFormat.unregister_extra_format(format)
202
 
        self.assertFalse(format in workingtree.WorkingTreeFormat.get_formats())
203
174
 
204
175
 
205
176
class TestWorkingTreeFormat3(TestCaseWithTransport):