~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
392
392
            get_transport(self.get_readonly_url('g/p/q')))
393
393
        self.assertEqual('g/p/q', relpath)
394
394
 
 
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)
 
403
        
 
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,
 
407
                          transport)
 
408
 
 
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,
 
415
                          transport)
 
416
 
395
417
 
396
418
class TestMeta1DirFormat(TestCaseWithTransport):
397
419
    """Tests specific to the meta1 dir format."""