127
124
my_format_registry = self.make_format_registry()
128
125
self.assertEqual('Format registered lazily',
129
126
my_format_registry.get_help('lazy'))
130
self.assertEqual('Format using knits',
127
self.assertEqual('Format using knits',
131
128
my_format_registry.get_help('knit'))
132
self.assertEqual('Format using knits',
129
self.assertEqual('Format using knits',
133
130
my_format_registry.get_help('default'))
134
131
self.assertEqual('Pre-0.8 format. Slower and does not support'
135
' checkouts or shared repositories',
132
' checkouts or shared repositories',
136
133
my_format_registry.get_help('weave'))
138
135
def test_help_topic(self):
139
136
topics = help_topics.HelpTopicRegistry()
140
registry = self.make_format_registry()
141
topics.register('current-formats', registry.help_topic,
143
topics.register('other-formats', registry.help_topic,
145
new = topics.get_detail('current-formats')
146
rest = topics.get_detail('other-formats')
147
experimental, deprecated = rest.split('Deprecated formats')
148
self.assertContainsRe(new, 'formats-help')
149
self.assertContainsRe(new,
150
':knit:\n \(native\) \(default\) Format using knits\n')
151
self.assertContainsRe(experimental,
152
':branch6:\n \(native\) Experimental successor to knit')
153
self.assertContainsRe(deprecated,
154
':lazy:\n \(native\) Format registered lazily\n')
137
topics.register('formats', self.make_format_registry().help_topic,
139
topic = topics.get_detail('formats')
140
new, deprecated = topic.split('Deprecated formats')
141
self.assertContainsRe(new, 'Bazaar directory formats')
142
self.assertContainsRe(new,
143
' knit/default:\n \(native\) Format using knits\n')
144
self.assertContainsRe(deprecated,
145
' lazy:\n \(native\) Format registered lazily\n')
155
146
self.assertNotContainsRe(new, 'hidden')
157
148
def test_set_default_repository(self):
422
413
branch.bzrdir.open_workingtree()
425
class TestRepositoryAcquisitionPolicy(TestCaseWithTransport):
427
def test_acquire_repository_standalone(self):
428
"""The default acquisition policy should create a standalone branch."""
429
my_bzrdir = self.make_bzrdir('.')
430
repo_policy = my_bzrdir.determine_repository_policy()
431
repo, is_new = repo_policy.acquire_repository()
432
self.assertEqual(repo.bzrdir.root_transport.base,
433
my_bzrdir.root_transport.base)
434
self.assertFalse(repo.is_shared())
436
def test_determine_stacking_policy(self):
437
parent_bzrdir = self.make_bzrdir('.')
438
child_bzrdir = self.make_bzrdir('child')
439
parent_bzrdir.get_config().set_default_stack_on('http://example.org')
440
repo_policy = child_bzrdir.determine_repository_policy()
441
self.assertEqual('http://example.org', repo_policy._stack_on)
443
def test_determine_stacking_policy_relative(self):
444
parent_bzrdir = self.make_bzrdir('.')
445
child_bzrdir = self.make_bzrdir('child')
446
parent_bzrdir.get_config().set_default_stack_on('child2')
447
repo_policy = child_bzrdir.determine_repository_policy()
448
self.assertEqual('child2', repo_policy._stack_on)
449
self.assertEqual(parent_bzrdir.root_transport.base,
450
repo_policy._stack_on_pwd)
452
def prepare_default_stacking(self, child_format='1.6'):
453
parent_bzrdir = self.make_bzrdir('.')
454
child_branch = self.make_branch('child', format=child_format)
455
parent_bzrdir.get_config().set_default_stack_on(child_branch.base)
456
new_child_transport = parent_bzrdir.transport.clone('child2')
457
return child_branch, new_child_transport
459
def test_clone_on_transport_obeys_stacking_policy(self):
460
child_branch, new_child_transport = self.prepare_default_stacking()
461
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport)
462
self.assertEqual(child_branch.base,
463
new_child.open_branch().get_stacked_on_url())
465
def test_default_stacking_with_stackable_branch_unstackable_repo(self):
466
# Make stackable source branch with an unstackable repo format.
467
source_bzrdir = self.make_bzrdir('source')
468
pack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
469
source_branch = bzrlib.branch.BzrBranchFormat7().initialize(source_bzrdir)
470
# Make a directory with a default stacking policy
471
parent_bzrdir = self.make_bzrdir('parent')
472
stacked_on = self.make_branch('parent/stacked-on', format='pack-0.92')
473
parent_bzrdir.get_config().set_default_stack_on(stacked_on.base)
474
# Clone source into directory
475
target = source_bzrdir.clone(self.get_url('parent/target'))
477
def test_sprout_obeys_stacking_policy(self):
478
child_branch, new_child_transport = self.prepare_default_stacking()
479
new_child = child_branch.bzrdir.sprout(new_child_transport.base)
480
self.assertEqual(child_branch.base,
481
new_child.open_branch().get_stacked_on_url())
483
def test_clone_ignores_policy_for_unsupported_formats(self):
484
child_branch, new_child_transport = self.prepare_default_stacking(
485
child_format='pack-0.92')
486
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport)
487
self.assertRaises(errors.UnstackableBranchFormat,
488
new_child.open_branch().get_stacked_on_url)
490
def test_sprout_ignores_policy_for_unsupported_formats(self):
491
child_branch, new_child_transport = self.prepare_default_stacking(
492
child_format='pack-0.92')
493
new_child = child_branch.bzrdir.sprout(new_child_transport.base)
494
self.assertRaises(errors.UnstackableBranchFormat,
495
new_child.open_branch().get_stacked_on_url)
497
def test_sprout_upgrades_format_if_stacked_specified(self):
498
child_branch, new_child_transport = self.prepare_default_stacking(
499
child_format='pack-0.92')
500
new_child = child_branch.bzrdir.sprout(new_child_transport.base,
502
self.assertEqual(child_branch.bzrdir.root_transport.base,
503
new_child.open_branch().get_stacked_on_url())
504
repo = new_child.open_repository()
505
self.assertTrue(repo._format.supports_external_lookups)
506
self.assertFalse(repo.supports_rich_root())
508
def test_clone_on_transport_upgrades_format_if_stacked_on_specified(self):
509
child_branch, new_child_transport = self.prepare_default_stacking(
510
child_format='pack-0.92')
511
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport,
512
stacked_on=child_branch.bzrdir.root_transport.base)
513
self.assertEqual(child_branch.bzrdir.root_transport.base,
514
new_child.open_branch().get_stacked_on_url())
515
repo = new_child.open_repository()
516
self.assertTrue(repo._format.supports_external_lookups)
517
self.assertFalse(repo.supports_rich_root())
519
def test_sprout_upgrades_to_rich_root_format_if_needed(self):
520
child_branch, new_child_transport = self.prepare_default_stacking(
521
child_format='rich-root-pack')
522
new_child = child_branch.bzrdir.sprout(new_child_transport.base,
524
repo = new_child.open_repository()
525
self.assertTrue(repo._format.supports_external_lookups)
526
self.assertTrue(repo.supports_rich_root())
528
def test_add_fallback_repo_handles_absolute_urls(self):
529
stack_on = self.make_branch('stack_on', format='1.6')
530
repo = self.make_repository('repo', format='1.6')
531
policy = bzrdir.UseExistingRepository(repo, stack_on.base)
532
policy._add_fallback(repo)
534
def test_add_fallback_repo_handles_relative_urls(self):
535
stack_on = self.make_branch('stack_on', format='1.6')
536
repo = self.make_repository('repo', format='1.6')
537
policy = bzrdir.UseExistingRepository(repo, '.', stack_on.base)
538
policy._add_fallback(repo)
540
def test_configure_relative_branch_stacking_url(self):
541
stack_on = self.make_branch('stack_on', format='1.6')
542
stacked = self.make_branch('stack_on/stacked', format='1.6')
543
policy = bzrdir.UseExistingRepository(stacked.repository,
545
policy.configure_branch(stacked)
546
self.assertEqual('..', stacked.get_stacked_on_url())
548
def test_relative_branch_stacking_to_absolute(self):
549
stack_on = self.make_branch('stack_on', format='1.6')
550
stacked = self.make_branch('stack_on/stacked', format='1.6')
551
policy = bzrdir.UseExistingRepository(stacked.repository,
552
'.', self.get_readonly_url('stack_on'))
553
policy.configure_branch(stacked)
554
self.assertEqual(self.get_readonly_url('stack_on'),
555
stacked.get_stacked_on_url())
558
416
class ChrootedTests(TestCaseWithTransport):
559
417
"""A support class that provides readonly urls outside the local namespace.
582
437
branch, relpath = bzrdir.BzrDir.open_containing(self.get_readonly_url('g/p/q'))
583
438
self.assertEqual('g/p/q', relpath)
585
def test_open_containing_tree_branch_or_repository_empty(self):
586
self.assertRaises(errors.NotBranchError,
587
bzrdir.BzrDir.open_containing_tree_branch_or_repository,
588
self.get_readonly_url(''))
590
def test_open_containing_tree_branch_or_repository_all(self):
591
self.make_branch_and_tree('topdir')
592
tree, branch, repo, relpath = \
593
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
595
self.assertEqual(os.path.realpath('topdir'),
596
os.path.realpath(tree.basedir))
597
self.assertEqual(os.path.realpath('topdir'),
598
self.local_branch_path(branch))
600
osutils.realpath(os.path.join('topdir', '.bzr', 'repository')),
601
repo.bzrdir.transport.local_abspath('repository'))
602
self.assertEqual(relpath, 'foo')
604
def test_open_containing_tree_branch_or_repository_no_tree(self):
605
self.make_branch('branch')
606
tree, branch, repo, relpath = \
607
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
609
self.assertEqual(tree, None)
610
self.assertEqual(os.path.realpath('branch'),
611
self.local_branch_path(branch))
613
osutils.realpath(os.path.join('branch', '.bzr', 'repository')),
614
repo.bzrdir.transport.local_abspath('repository'))
615
self.assertEqual(relpath, 'foo')
617
def test_open_containing_tree_branch_or_repository_repo(self):
618
self.make_repository('repo')
619
tree, branch, repo, relpath = \
620
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
622
self.assertEqual(tree, None)
623
self.assertEqual(branch, None)
625
osutils.realpath(os.path.join('repo', '.bzr', 'repository')),
626
repo.bzrdir.transport.local_abspath('repository'))
627
self.assertEqual(relpath, '')
629
def test_open_containing_tree_branch_or_repository_shared_repo(self):
630
self.make_repository('shared', shared=True)
631
bzrdir.BzrDir.create_branch_convenience('shared/branch',
632
force_new_tree=False)
633
tree, branch, repo, relpath = \
634
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
636
self.assertEqual(tree, None)
637
self.assertEqual(os.path.realpath('shared/branch'),
638
self.local_branch_path(branch))
640
osutils.realpath(os.path.join('shared', '.bzr', 'repository')),
641
repo.bzrdir.transport.local_abspath('repository'))
642
self.assertEqual(relpath, '')
644
def test_open_containing_tree_branch_or_repository_branch_subdir(self):
645
self.make_branch_and_tree('foo')
646
self.build_tree(['foo/bar/'])
647
tree, branch, repo, relpath = \
648
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
650
self.assertEqual(os.path.realpath('foo'),
651
os.path.realpath(tree.basedir))
652
self.assertEqual(os.path.realpath('foo'),
653
self.local_branch_path(branch))
655
osutils.realpath(os.path.join('foo', '.bzr', 'repository')),
656
repo.bzrdir.transport.local_abspath('repository'))
657
self.assertEqual(relpath, 'bar')
659
def test_open_containing_tree_branch_or_repository_repo_subdir(self):
660
self.make_repository('bar')
661
self.build_tree(['bar/baz/'])
662
tree, branch, repo, relpath = \
663
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
665
self.assertEqual(tree, None)
666
self.assertEqual(branch, None)
668
osutils.realpath(os.path.join('bar', '.bzr', 'repository')),
669
repo.bzrdir.transport.local_abspath('repository'))
670
self.assertEqual(relpath, 'baz')
672
440
def test_open_containing_from_transport(self):
673
441
self.assertRaises(NotBranchError, bzrdir.BzrDir.open_containing_from_transport,
674
442
get_transport(self.get_readonly_url('')))
789
537
self.failUnlessExists('repo/tree2/subtree')
790
538
self.failIfExists('repo/tree2/subtree/file')
792
def make_foo_bar_baz(self):
793
foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
794
bar = self.make_branch('foo/bar').bzrdir
795
baz = self.make_branch('baz').bzrdir
798
def test_find_bzrdirs(self):
799
foo, bar, baz = self.make_foo_bar_baz()
800
transport = get_transport(self.get_url())
801
self.assertEqualBzrdirs([baz, foo, bar],
802
bzrdir.BzrDir.find_bzrdirs(transport))
804
def test_find_bzrdirs_list_current(self):
805
def list_current(transport):
806
return [s for s in transport.list_dir('') if s != 'baz']
808
foo, bar, baz = self.make_foo_bar_baz()
809
transport = get_transport(self.get_url())
810
self.assertEqualBzrdirs([foo, bar],
811
bzrdir.BzrDir.find_bzrdirs(transport,
812
list_current=list_current))
815
def test_find_bzrdirs_evaluate(self):
816
def evaluate(bzrdir):
818
repo = bzrdir.open_repository()
819
except NoRepositoryPresent:
820
return True, bzrdir.root_transport.base
822
return False, bzrdir.root_transport.base
824
foo, bar, baz = self.make_foo_bar_baz()
825
transport = get_transport(self.get_url())
826
self.assertEqual([baz.root_transport.base, foo.root_transport.base],
827
list(bzrdir.BzrDir.find_bzrdirs(transport,
830
def assertEqualBzrdirs(self, first, second):
832
second = list(second)
833
self.assertEqual(len(first), len(second))
834
for x, y in zip(first, second):
835
self.assertEqual(x.root_transport.base, y.root_transport.base)
837
def test_find_branches(self):
838
root = self.make_repository('', shared=True)
839
foo, bar, baz = self.make_foo_bar_baz()
840
qux = self.make_bzrdir('foo/qux')
841
transport = get_transport(self.get_url())
842
branches = bzrdir.BzrDir.find_branches(transport)
843
self.assertEqual(baz.root_transport.base, branches[0].base)
844
self.assertEqual(foo.root_transport.base, branches[1].base)
845
self.assertEqual(bar.root_transport.base, branches[2].base)
847
# ensure this works without a top-level repo
848
branches = bzrdir.BzrDir.find_branches(transport.clone('foo'))
849
self.assertEqual(foo.root_transport.base, branches[0].base)
850
self.assertEqual(bar.root_transport.base, branches[1].base)
853
541
class TestMeta1DirFormat(TestCaseWithTransport):
854
542
"""Tests specific to the meta1 dir format."""
1093
776
workingtree.WorkingTreeFormat3)
1096
class TestHTTPRedirections(object):
1097
"""Test redirection between two http servers.
779
class TestHTTPRedirectionLoop(object):
780
"""Test redirection loop between two http servers.
1099
782
This MUST be used by daughter classes that also inherit from
1100
783
TestCaseWithTwoWebservers.
1102
785
We can't inherit directly from TestCaseWithTwoWebservers or the
1103
786
test framework will try to create an instance which cannot
1104
run, its implementation being incomplete.
787
run, its implementation being incomplete.
790
# Should be defined by daughter classes to ensure redirection
791
# still use the same transport implementation (not currently
792
# enforced as it's a bit tricky to get right (see the FIXME
793
# in BzrDir.open_from_transport for the unique use case so
1107
797
def create_transport_readonly_server(self):
1108
return http_utils.HTTPServerRedirecting()
798
return HTTPServerRedirecting()
1110
800
def create_transport_secondary_server(self):
1111
return http_utils.HTTPServerRedirecting()
801
return HTTPServerRedirecting()
1113
803
def setUp(self):
1114
super(TestHTTPRedirections, self).setUp()
804
# Both servers redirect to each server creating a loop
805
super(TestHTTPRedirectionLoop, self).setUp()
1115
806
# The redirections will point to the new server
1116
807
self.new_server = self.get_readonly_server()
1117
808
# The requests to the old server will be redirected
1118
809
self.old_server = self.get_secondary_server()
1119
810
# Configure the redirections
1120
811
self.old_server.redirect_to(self.new_server.host, self.new_server.port)
812
self.new_server.redirect_to(self.old_server.host, self.old_server.port)
814
def _qualified_url(self, host, port):
815
return 'http+%s://%s:%s' % (self._qualifier, host, port)
1122
817
def test_loop(self):
1123
# Both servers redirect to each other creating a loop
1124
self.new_server.redirect_to(self.old_server.host, self.old_server.port)
1125
818
# Starting from either server should loop
1126
old_url = self._qualified_url(self.old_server.host,
819
old_url = self._qualified_url(self.old_server.host,
1127
820
self.old_server.port)
1128
821
oldt = self._transport(old_url)
1129
822
self.assertRaises(errors.NotBranchError,
1130
823
bzrdir.BzrDir.open_from_transport, oldt)
1131
new_url = self._qualified_url(self.new_server.host,
824
new_url = self._qualified_url(self.new_server.host,
1132
825
self.new_server.port)
1133
826
newt = self._transport(new_url)
1134
827
self.assertRaises(errors.NotBranchError,
1135
828
bzrdir.BzrDir.open_from_transport, newt)
1137
def test_qualifier_preserved(self):
1138
wt = self.make_branch_and_tree('branch')
1139
old_url = self._qualified_url(self.old_server.host,
1140
self.old_server.port)
1141
start = self._transport(old_url).clone('branch')
1142
bdir = bzrdir.BzrDir.open_from_transport(start)
1143
# Redirection should preserve the qualifier, hence the transport class
1145
self.assertIsInstance(bdir.root_transport, type(start))
1148
class TestHTTPRedirections_urllib(TestHTTPRedirections,
1149
http_utils.TestCaseWithTwoWebservers):
831
class TestHTTPRedirections_urllib(TestHTTPRedirectionLoop,
832
TestCaseWithTwoWebservers):
1150
833
"""Tests redirections for urllib implementation"""
835
_qualifier = 'urllib'
1152
836
_transport = HttpTransport_urllib
1154
def _qualified_url(self, host, port):
1155
result = 'http+urllib://%s:%s' % (host, port)
1156
self.permit_url(result)
1161
840
class TestHTTPRedirections_pycurl(TestWithTransport_pycurl,
1162
TestHTTPRedirections,
1163
http_utils.TestCaseWithTwoWebservers):
841
TestHTTPRedirectionLoop,
842
TestCaseWithTwoWebservers):
1164
843
"""Tests redirections for pycurl implementation"""
1166
def _qualified_url(self, host, port):
1167
result = 'http+pycurl://%s:%s' % (host, port)
1168
self.permit_url(result)
1172
class TestHTTPRedirections_nosmart(TestHTTPRedirections,
1173
http_utils.TestCaseWithTwoWebservers):
1174
"""Tests redirections for the nosmart decorator"""
1176
_transport = NoSmartTransportDecorator
1178
def _qualified_url(self, host, port):
1179
result = 'nosmart+http://%s:%s' % (host, port)
1180
self.permit_url(result)
1184
class TestHTTPRedirections_readonly(TestHTTPRedirections,
1185
http_utils.TestCaseWithTwoWebservers):
1186
"""Tests redirections for readonly decoratror"""
1188
_transport = ReadonlyTransportDecorator
1190
def _qualified_url(self, host, port):
1191
result = 'readonly+http://%s:%s' % (host, port)
1192
self.permit_url(result)
1196
class TestDotBzrHidden(TestCaseWithTransport):
1199
if sys.platform == 'win32':
1200
ls = [os.environ['COMSPEC'], '/C', 'dir', '/B']
1203
f = subprocess.Popen(self.ls, stdout=subprocess.PIPE,
1204
stderr=subprocess.PIPE)
1205
out, err = f.communicate()
1206
self.assertEqual(0, f.returncode, 'Calling %s failed: %s'
1208
return out.splitlines()
1210
def test_dot_bzr_hidden(self):
1211
if sys.platform == 'win32' and not win32utils.has_win32file:
1212
raise TestSkipped('unable to make file hidden without pywin32 library')
1213
b = bzrdir.BzrDir.create('.')
1214
self.build_tree(['a'])
1215
self.assertEquals(['a'], self.get_ls())
1217
def test_dot_bzr_hidden_with_url(self):
1218
if sys.platform == 'win32' and not win32utils.has_win32file:
1219
raise TestSkipped('unable to make file hidden without pywin32 library')
1220
b = bzrdir.BzrDir.create(urlutils.local_path_to_url('.'))
1221
self.build_tree(['a'])
1222
self.assertEquals(['a'], self.get_ls())
1225
class _TestBzrDirFormat(bzrdir.BzrDirMetaFormat1):
1226
"""Test BzrDirFormat implementation for TestBzrDirSprout."""
1228
def _open(self, transport):
1229
return _TestBzrDir(transport, self)
1232
class _TestBzrDir(bzrdir.BzrDirMeta1):
1233
"""Test BzrDir implementation for TestBzrDirSprout.
1235
When created a _TestBzrDir already has repository and a branch. The branch
1236
is a test double as well.
1239
def __init__(self, *args, **kwargs):
1240
super(_TestBzrDir, self).__init__(*args, **kwargs)
1241
self.test_branch = _TestBranch()
1242
self.test_branch.repository = self.create_repository()
1244
def open_branch(self, unsupported=False):
1245
return self.test_branch
1247
def cloning_metadir(self, require_stacking=False):
1248
return _TestBzrDirFormat()
1251
class _TestBranchFormat(bzrlib.branch.BranchFormat):
1252
"""Test Branch format for TestBzrDirSprout."""
1255
class _TestBranch(bzrlib.branch.Branch):
1256
"""Test Branch implementation for TestBzrDirSprout."""
1258
def __init__(self, *args, **kwargs):
1259
self._format = _TestBranchFormat()
1260
super(_TestBranch, self).__init__(*args, **kwargs)
1264
def sprout(self, *args, **kwargs):
1265
self.calls.append('sprout')
1266
return _TestBranch()
1268
def copy_content_into(self, destination, revision_id=None):
1269
self.calls.append('copy_content_into')
1271
def get_parent(self):
1274
def set_parent(self, parent):
1275
self._parent = parent
1278
class TestBzrDirSprout(TestCaseWithMemoryTransport):
1280
def test_sprout_uses_branch_sprout(self):
1281
"""BzrDir.sprout calls Branch.sprout.
1283
Usually, BzrDir.sprout should delegate to the branch's sprout method
1284
for part of the work. This allows the source branch to control the
1285
choice of format for the new branch.
1287
There are exceptions, but this tests avoids them:
1288
- if there's no branch in the source bzrdir,
1289
- or if the stacking has been requested and the format needs to be
1290
overridden to satisfy that.
1292
# Make an instrumented bzrdir.
1293
t = self.get_transport('source')
1295
source_bzrdir = _TestBzrDirFormat().initialize_on_transport(t)
1296
# The instrumented bzrdir has a test_branch attribute that logs calls
1297
# made to the branch contained in that bzrdir. Initially the test
1298
# branch exists but no calls have been made to it.
1299
self.assertEqual([], source_bzrdir.test_branch.calls)
1302
target_url = self.get_url('target')
1303
result = source_bzrdir.sprout(target_url, recurse='no')
1305
# The bzrdir called the branch's sprout method.
1306
self.assertSubset(['sprout'], source_bzrdir.test_branch.calls)
1308
def test_sprout_parent(self):
1309
grandparent_tree = self.make_branch('grandparent')
1310
parent = grandparent_tree.bzrdir.sprout('parent').open_branch()
1311
branch_tree = parent.bzrdir.sprout('branch').open_branch()
1312
self.assertContainsRe(branch_tree.get_parent(), '/parent/$')
1315
class TestBzrDirHooks(TestCaseWithMemoryTransport):
1317
def test_pre_open_called(self):
1319
bzrdir.BzrDir.hooks.install_named_hook('pre_open', calls.append, None)
1320
transport = self.get_transport('foo')
1321
url = transport.base
1322
self.assertRaises(errors.NotBranchError, bzrdir.BzrDir.open, url)
1323
self.assertEqual([transport.base], [t.base for t in calls])
1325
def test_pre_open_actual_exceptions_raised(self):
1327
def fail_once(transport):
1330
raise errors.BzrError("fail")
1331
bzrdir.BzrDir.hooks.install_named_hook('pre_open', fail_once, None)
1332
transport = self.get_transport('foo')
1333
url = transport.base
1334
err = self.assertRaises(errors.BzrError, bzrdir.BzrDir.open, url)
1335
self.assertEqual('fail', err._preformatted_string)
845
_qualifier = 'pycurl'