31
31
import bzrlib.repository as repository
32
32
from bzrlib.tests import TestCase, TestCaseWithTransport
33
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
33
34
from bzrlib.transport import get_transport
34
35
from bzrlib.transport.http import HttpServer
35
36
from bzrlib.transport.memory import MemoryServer
457
458
bzrdir.BzrDirFormat.set_default_format(old_format)
458
459
self.assertFalse(dir.needs_format_conversion())
462
class NonLocalTests(TestCaseWithTransport):
463
"""Tests for bzrdir static behaviour on non local paths."""
466
super(NonLocalTests, self).setUp()
467
self.transport_server = MemoryServer
469
def test_create_branch_convenience(self):
470
# outside a repo the default convenience output is a repo+branch_tree
471
old_format = bzrdir.BzrDirFormat.get_default_format()
472
bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
474
branch = bzrdir.BzrDir.create_branch_convenience(self.get_url('foo'))
475
self.assertRaises(errors.NoWorkingTree,
476
branch.bzrdir.open_workingtree)
477
branch.bzrdir.open_repository()
479
bzrdir.BzrDirFormat.set_default_format(old_format)
481
def test_create_branch_convenience_force_tree_not_local_fails(self):
482
# outside a repo the default convenience output is a repo+branch_tree
483
old_format = bzrdir.BzrDirFormat.get_default_format()
484
bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
486
self.assertRaises(errors.NotLocalUrl,
487
bzrdir.BzrDir.create_branch_convenience,
490
t = get_transport(self.get_url('.'))
491
self.assertFalse(t.has('foo'))
493
bzrdir.BzrDirFormat.set_default_format(old_format)