392
392
get_transport(self.get_readonly_url('g/p/q')))
393
393
self.assertEqual('g/p/q', relpath)
395
def test_open_from_transport(self):
396
# transport pointing at bzrdir should give a bzrdir with root transport
397
# set to the given transport
398
control = bzrdir.BzrDir.create(self.get_url())
399
transport = get_transport(self.get_url())
400
opened_bzrdir = bzrdir.BzrDir.open_from_transport(transport)
401
self.assertEqual(transport.base, opened_bzrdir.root_transport.base)
402
self.assertIsInstance(opened_bzrdir, bzrdir.BzrDir)
404
def test_open_from_transport_no_bzrdir(self):
405
transport = get_transport(self.get_url())
406
self.assertRaises(NotBranchError, bzrdir.BzrDir.open_from_transport,
409
def test_open_from_transport_bzrdir_in_parent(self):
410
control = bzrdir.BzrDir.create(self.get_url())
411
transport = get_transport(self.get_url())
412
transport.mkdir('subdir')
413
transport = transport.clone('subdir')
414
self.assertRaises(NotBranchError, bzrdir.BzrDir.open_from_transport,
396
418
class TestMeta1DirFormat(TestCaseWithTransport):
397
419
"""Tests specific to the meta1 dir format."""