/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

add working tree to the BzrDir facilities.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
import bzrlib.transactions as transactions
37
37
from bzrlib.transport import get_transport
38
38
from bzrlib.upgrade import upgrade
39
 
from bzrlib.workingtree import WorkingTree
 
39
import bzrlib.workingtree as workingtree
40
40
 
41
41
 
42
42
class TestCaseWithBzrDir(TestCaseWithTransport):
180
180
        opened_repo = made_control.open_repository()
181
181
        self.assertEqual(made_control, opened_repo.bzrdir)
182
182
        self.failUnless(isinstance(opened_repo, made_repo.__class__))
 
183
 
 
184
    def test_create_workingtree(self):
 
185
        # a bzrdir can construct a working tree for itself.
 
186
        if not self.bzrdir_format.is_supported():
 
187
            # unsupported formats are not loopback testable
 
188
            # because the default open will not open them and
 
189
            # they may not be initializable.
 
190
            return
 
191
        # this has to be tested with local access as we still support creating 
 
192
        # format 6 bzrdirs
 
193
        t = get_transport('.')
 
194
        made_control = self.bzrdir_format.initialize(t.base)
 
195
        made_repo = made_control.create_repository()
 
196
        made_branch = made_control.create_branch()
 
197
        made_tree = made_control.create_workingtree()
 
198
        self.failUnless(isinstance(made_tree, workingtree.WorkingTree))
 
199
        self.assertEqual(made_control, made_tree.bzrdir)
 
200
        
 
201
    def test_open_workingtree(self):
 
202
        if not self.bzrdir_format.is_supported():
 
203
            # unsupported formats are not loopback testable
 
204
            # because the default open will not open them and
 
205
            # they may not be initializable.
 
206
            return
 
207
        # this has to be tested with local access as we still support creating 
 
208
        # format 6 bzrdirs
 
209
        t = get_transport('.')
 
210
        made_control = self.bzrdir_format.initialize(t.base)
 
211
        made_repo = made_control.create_repository()
 
212
        made_branch = made_control.create_branch()
 
213
        made_tree = made_control.create_workingtree()
 
214
        opened_tree = made_control.open_workingtree()
 
215
        self.assertEqual(made_control, opened_tree.bzrdir)
 
216
        self.failUnless(isinstance(opened_tree, made_tree.__class__))
 
217