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
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__))
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.
191
# this has to be tested with local access as we still support creating
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)
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.
207
# this has to be tested with local access as we still support creating
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__))