129
124
my_format_registry = self.make_format_registry()
130
125
self.assertEqual('Format registered lazily',
131
126
my_format_registry.get_help('lazy'))
132
self.assertEqual('Format using knits',
127
self.assertEqual('Format using knits',
133
128
my_format_registry.get_help('knit'))
134
self.assertEqual('Format using knits',
129
self.assertEqual('Format using knits',
135
130
my_format_registry.get_help('default'))
136
131
self.assertEqual('Pre-0.8 format. Slower and does not support'
137
' checkouts or shared repositories',
132
' checkouts or shared repositories',
138
133
my_format_registry.get_help('weave'))
140
135
def test_help_topic(self):
141
136
topics = help_topics.HelpTopicRegistry()
142
registry = self.make_format_registry()
143
topics.register('current-formats', registry.help_topic,
145
topics.register('other-formats', registry.help_topic,
147
new = topics.get_detail('current-formats')
148
rest = topics.get_detail('other-formats')
149
experimental, deprecated = rest.split('Deprecated formats')
150
self.assertContainsRe(new, 'formats-help')
151
self.assertContainsRe(new,
152
':knit:\n \(native\) \(default\) Format using knits\n')
153
self.assertContainsRe(experimental,
154
':branch6:\n \(native\) Experimental successor to knit')
155
self.assertContainsRe(deprecated,
156
':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')
157
146
self.assertNotContainsRe(new, 'hidden')
159
148
def test_set_default_repository(self):
424
413
branch.bzrdir.open_workingtree()
427
class TestRepositoryAcquisitionPolicy(TestCaseWithTransport):
429
def test_acquire_repository_standalone(self):
430
"""The default acquisition policy should create a standalone branch."""
431
my_bzrdir = self.make_bzrdir('.')
432
repo_policy = my_bzrdir.determine_repository_policy()
433
repo, is_new = repo_policy.acquire_repository()
434
self.assertEqual(repo.bzrdir.root_transport.base,
435
my_bzrdir.root_transport.base)
436
self.assertFalse(repo.is_shared())
438
def test_determine_stacking_policy(self):
439
parent_bzrdir = self.make_bzrdir('.')
440
child_bzrdir = self.make_bzrdir('child')
441
parent_bzrdir.get_config().set_default_stack_on('http://example.org')
442
repo_policy = child_bzrdir.determine_repository_policy()
443
self.assertEqual('http://example.org', repo_policy._stack_on)
445
def test_determine_stacking_policy_relative(self):
446
parent_bzrdir = self.make_bzrdir('.')
447
child_bzrdir = self.make_bzrdir('child')
448
parent_bzrdir.get_config().set_default_stack_on('child2')
449
repo_policy = child_bzrdir.determine_repository_policy()
450
self.assertEqual('child2', repo_policy._stack_on)
451
self.assertEqual(parent_bzrdir.root_transport.base,
452
repo_policy._stack_on_pwd)
454
def prepare_default_stacking(self, child_format='1.6'):
455
parent_bzrdir = self.make_bzrdir('.')
456
child_branch = self.make_branch('child', format=child_format)
457
parent_bzrdir.get_config().set_default_stack_on(child_branch.base)
458
new_child_transport = parent_bzrdir.transport.clone('child2')
459
return child_branch, new_child_transport
461
def test_clone_on_transport_obeys_stacking_policy(self):
462
child_branch, new_child_transport = self.prepare_default_stacking()
463
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport)
464
self.assertEqual(child_branch.base,
465
new_child.open_branch().get_stacked_on_url())
467
def test_default_stacking_with_stackable_branch_unstackable_repo(self):
468
# Make stackable source branch with an unstackable repo format.
469
source_bzrdir = self.make_bzrdir('source')
470
pack_repo.RepositoryFormatKnitPack1().initialize(source_bzrdir)
471
source_branch = bzrlib.branch.BzrBranchFormat7().initialize(source_bzrdir)
472
# Make a directory with a default stacking policy
473
parent_bzrdir = self.make_bzrdir('parent')
474
stacked_on = self.make_branch('parent/stacked-on', format='pack-0.92')
475
parent_bzrdir.get_config().set_default_stack_on(stacked_on.base)
476
# Clone source into directory
477
target = source_bzrdir.clone(self.get_url('parent/target'))
479
def test_sprout_obeys_stacking_policy(self):
480
child_branch, new_child_transport = self.prepare_default_stacking()
481
new_child = child_branch.bzrdir.sprout(new_child_transport.base)
482
self.assertEqual(child_branch.base,
483
new_child.open_branch().get_stacked_on_url())
485
def test_clone_ignores_policy_for_unsupported_formats(self):
486
child_branch, new_child_transport = self.prepare_default_stacking(
487
child_format='pack-0.92')
488
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport)
489
self.assertRaises(errors.UnstackableBranchFormat,
490
new_child.open_branch().get_stacked_on_url)
492
def test_sprout_ignores_policy_for_unsupported_formats(self):
493
child_branch, new_child_transport = self.prepare_default_stacking(
494
child_format='pack-0.92')
495
new_child = child_branch.bzrdir.sprout(new_child_transport.base)
496
self.assertRaises(errors.UnstackableBranchFormat,
497
new_child.open_branch().get_stacked_on_url)
499
def test_sprout_upgrades_format_if_stacked_specified(self):
500
child_branch, new_child_transport = self.prepare_default_stacking(
501
child_format='pack-0.92')
502
new_child = child_branch.bzrdir.sprout(new_child_transport.base,
504
self.assertEqual(child_branch.bzrdir.root_transport.base,
505
new_child.open_branch().get_stacked_on_url())
506
repo = new_child.open_repository()
507
self.assertTrue(repo._format.supports_external_lookups)
508
self.assertFalse(repo.supports_rich_root())
510
def test_clone_on_transport_upgrades_format_if_stacked_on_specified(self):
511
child_branch, new_child_transport = self.prepare_default_stacking(
512
child_format='pack-0.92')
513
new_child = child_branch.bzrdir.clone_on_transport(new_child_transport,
514
stacked_on=child_branch.bzrdir.root_transport.base)
515
self.assertEqual(child_branch.bzrdir.root_transport.base,
516
new_child.open_branch().get_stacked_on_url())
517
repo = new_child.open_repository()
518
self.assertTrue(repo._format.supports_external_lookups)
519
self.assertFalse(repo.supports_rich_root())
521
def test_sprout_upgrades_to_rich_root_format_if_needed(self):
522
child_branch, new_child_transport = self.prepare_default_stacking(
523
child_format='rich-root-pack')
524
new_child = child_branch.bzrdir.sprout(new_child_transport.base,
526
repo = new_child.open_repository()
527
self.assertTrue(repo._format.supports_external_lookups)
528
self.assertTrue(repo.supports_rich_root())
530
def test_add_fallback_repo_handles_absolute_urls(self):
531
stack_on = self.make_branch('stack_on', format='1.6')
532
repo = self.make_repository('repo', format='1.6')
533
policy = bzrdir.UseExistingRepository(repo, stack_on.base)
534
policy._add_fallback(repo)
536
def test_add_fallback_repo_handles_relative_urls(self):
537
stack_on = self.make_branch('stack_on', format='1.6')
538
repo = self.make_repository('repo', format='1.6')
539
policy = bzrdir.UseExistingRepository(repo, '.', stack_on.base)
540
policy._add_fallback(repo)
542
def test_configure_relative_branch_stacking_url(self):
543
stack_on = self.make_branch('stack_on', format='1.6')
544
stacked = self.make_branch('stack_on/stacked', format='1.6')
545
policy = bzrdir.UseExistingRepository(stacked.repository,
547
policy.configure_branch(stacked)
548
self.assertEqual('..', stacked.get_stacked_on_url())
550
def test_relative_branch_stacking_to_absolute(self):
551
stack_on = self.make_branch('stack_on', format='1.6')
552
stacked = self.make_branch('stack_on/stacked', format='1.6')
553
policy = bzrdir.UseExistingRepository(stacked.repository,
554
'.', self.get_readonly_url('stack_on'))
555
policy.configure_branch(stacked)
556
self.assertEqual(self.get_readonly_url('stack_on'),
557
stacked.get_stacked_on_url())
560
416
class ChrootedTests(TestCaseWithTransport):
561
417
"""A support class that provides readonly urls outside the local namespace.
584
437
branch, relpath = bzrdir.BzrDir.open_containing(self.get_readonly_url('g/p/q'))
585
438
self.assertEqual('g/p/q', relpath)
587
def test_open_containing_tree_branch_or_repository_empty(self):
588
self.assertRaises(errors.NotBranchError,
589
bzrdir.BzrDir.open_containing_tree_branch_or_repository,
590
self.get_readonly_url(''))
592
def test_open_containing_tree_branch_or_repository_all(self):
593
self.make_branch_and_tree('topdir')
594
tree, branch, repo, relpath = \
595
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
597
self.assertEqual(os.path.realpath('topdir'),
598
os.path.realpath(tree.basedir))
599
self.assertEqual(os.path.realpath('topdir'),
600
self.local_branch_path(branch))
602
osutils.realpath(os.path.join('topdir', '.bzr', 'repository')),
603
repo.bzrdir.transport.local_abspath('repository'))
604
self.assertEqual(relpath, 'foo')
606
def test_open_containing_tree_branch_or_repository_no_tree(self):
607
self.make_branch('branch')
608
tree, branch, repo, relpath = \
609
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
611
self.assertEqual(tree, None)
612
self.assertEqual(os.path.realpath('branch'),
613
self.local_branch_path(branch))
615
osutils.realpath(os.path.join('branch', '.bzr', 'repository')),
616
repo.bzrdir.transport.local_abspath('repository'))
617
self.assertEqual(relpath, 'foo')
619
def test_open_containing_tree_branch_or_repository_repo(self):
620
self.make_repository('repo')
621
tree, branch, repo, relpath = \
622
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
624
self.assertEqual(tree, None)
625
self.assertEqual(branch, None)
627
osutils.realpath(os.path.join('repo', '.bzr', 'repository')),
628
repo.bzrdir.transport.local_abspath('repository'))
629
self.assertEqual(relpath, '')
631
def test_open_containing_tree_branch_or_repository_shared_repo(self):
632
self.make_repository('shared', shared=True)
633
bzrdir.BzrDir.create_branch_convenience('shared/branch',
634
force_new_tree=False)
635
tree, branch, repo, relpath = \
636
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
638
self.assertEqual(tree, None)
639
self.assertEqual(os.path.realpath('shared/branch'),
640
self.local_branch_path(branch))
642
osutils.realpath(os.path.join('shared', '.bzr', 'repository')),
643
repo.bzrdir.transport.local_abspath('repository'))
644
self.assertEqual(relpath, '')
646
def test_open_containing_tree_branch_or_repository_branch_subdir(self):
647
self.make_branch_and_tree('foo')
648
self.build_tree(['foo/bar/'])
649
tree, branch, repo, relpath = \
650
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
652
self.assertEqual(os.path.realpath('foo'),
653
os.path.realpath(tree.basedir))
654
self.assertEqual(os.path.realpath('foo'),
655
self.local_branch_path(branch))
657
osutils.realpath(os.path.join('foo', '.bzr', 'repository')),
658
repo.bzrdir.transport.local_abspath('repository'))
659
self.assertEqual(relpath, 'bar')
661
def test_open_containing_tree_branch_or_repository_repo_subdir(self):
662
self.make_repository('bar')
663
self.build_tree(['bar/baz/'])
664
tree, branch, repo, relpath = \
665
bzrdir.BzrDir.open_containing_tree_branch_or_repository(
667
self.assertEqual(tree, None)
668
self.assertEqual(branch, None)
670
osutils.realpath(os.path.join('bar', '.bzr', 'repository')),
671
repo.bzrdir.transport.local_abspath('repository'))
672
self.assertEqual(relpath, 'baz')
674
440
def test_open_containing_from_transport(self):
675
441
self.assertRaises(NotBranchError, bzrdir.BzrDir.open_containing_from_transport,
676
442
get_transport(self.get_readonly_url('')))
791
537
self.failUnlessExists('repo/tree2/subtree')
792
538
self.failIfExists('repo/tree2/subtree/file')
794
def make_foo_bar_baz(self):
795
foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
796
bar = self.make_branch('foo/bar').bzrdir
797
baz = self.make_branch('baz').bzrdir
800
def test_find_bzrdirs(self):
801
foo, bar, baz = self.make_foo_bar_baz()
802
transport = get_transport(self.get_url())
803
self.assertEqualBzrdirs([baz, foo, bar],
804
bzrdir.BzrDir.find_bzrdirs(transport))
806
def test_find_bzrdirs_list_current(self):
807
def list_current(transport):
808
return [s for s in transport.list_dir('') if s != 'baz']
810
foo, bar, baz = self.make_foo_bar_baz()
811
transport = get_transport(self.get_url())
812
self.assertEqualBzrdirs([foo, bar],
813
bzrdir.BzrDir.find_bzrdirs(transport,
814
list_current=list_current))
817
def test_find_bzrdirs_evaluate(self):
818
def evaluate(bzrdir):
820
repo = bzrdir.open_repository()
821
except NoRepositoryPresent:
822
return True, bzrdir.root_transport.base
824
return False, bzrdir.root_transport.base
826
foo, bar, baz = self.make_foo_bar_baz()
827
transport = get_transport(self.get_url())
828
self.assertEqual([baz.root_transport.base, foo.root_transport.base],
829
list(bzrdir.BzrDir.find_bzrdirs(transport,
832
def assertEqualBzrdirs(self, first, second):
834
second = list(second)
835
self.assertEqual(len(first), len(second))
836
for x, y in zip(first, second):
837
self.assertEqual(x.root_transport.base, y.root_transport.base)
839
def test_find_branches(self):
840
root = self.make_repository('', shared=True)
841
foo, bar, baz = self.make_foo_bar_baz()
842
qux = self.make_bzrdir('foo/qux')
843
transport = get_transport(self.get_url())
844
branches = bzrdir.BzrDir.find_branches(transport)
845
self.assertEqual(baz.root_transport.base, branches[0].base)
846
self.assertEqual(foo.root_transport.base, branches[1].base)
847
self.assertEqual(bar.root_transport.base, branches[2].base)
849
# ensure this works without a top-level repo
850
branches = bzrdir.BzrDir.find_branches(transport.clone('foo'))
851
self.assertEqual(foo.root_transport.base, branches[0].base)
852
self.assertEqual(bar.root_transport.base, branches[1].base)
855
541
class TestMeta1DirFormat(TestCaseWithTransport):
856
542
"""Tests specific to the meta1 dir format."""
1095
776
workingtree.WorkingTreeFormat3)
1098
class TestHTTPRedirections(object):
1099
"""Test redirection between two http servers.
779
class TestHTTPRedirectionLoop(object):
780
"""Test redirection loop between two http servers.
1101
782
This MUST be used by daughter classes that also inherit from
1102
783
TestCaseWithTwoWebservers.
1104
785
We can't inherit directly from TestCaseWithTwoWebservers or the
1105
786
test framework will try to create an instance which cannot
1106
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
1109
797
def create_transport_readonly_server(self):
1110
return http_utils.HTTPServerRedirecting()
798
return HTTPServerRedirecting()
1112
800
def create_transport_secondary_server(self):
1113
return http_utils.HTTPServerRedirecting()
801
return HTTPServerRedirecting()
1115
803
def setUp(self):
1116
super(TestHTTPRedirections, self).setUp()
804
# Both servers redirect to each server creating a loop
805
super(TestHTTPRedirectionLoop, self).setUp()
1117
806
# The redirections will point to the new server
1118
807
self.new_server = self.get_readonly_server()
1119
808
# The requests to the old server will be redirected
1120
809
self.old_server = self.get_secondary_server()
1121
810
# Configure the redirections
1122
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)
1124
817
def test_loop(self):
1125
# Both servers redirect to each other creating a loop
1126
self.new_server.redirect_to(self.old_server.host, self.old_server.port)
1127
818
# Starting from either server should loop
1128
old_url = self._qualified_url(self.old_server.host,
819
old_url = self._qualified_url(self.old_server.host,
1129
820
self.old_server.port)
1130
821
oldt = self._transport(old_url)
1131
822
self.assertRaises(errors.NotBranchError,
1132
823
bzrdir.BzrDir.open_from_transport, oldt)
1133
new_url = self._qualified_url(self.new_server.host,
824
new_url = self._qualified_url(self.new_server.host,
1134
825
self.new_server.port)
1135
826
newt = self._transport(new_url)
1136
827
self.assertRaises(errors.NotBranchError,
1137
828
bzrdir.BzrDir.open_from_transport, newt)
1139
def test_qualifier_preserved(self):
1140
wt = self.make_branch_and_tree('branch')
1141
old_url = self._qualified_url(self.old_server.host,
1142
self.old_server.port)
1143
start = self._transport(old_url).clone('branch')
1144
bdir = bzrdir.BzrDir.open_from_transport(start)
1145
# Redirection should preserve the qualifier, hence the transport class
1147
self.assertIsInstance(bdir.root_transport, type(start))
1150
class TestHTTPRedirections_urllib(TestHTTPRedirections,
1151
http_utils.TestCaseWithTwoWebservers):
831
class TestHTTPRedirections_urllib(TestHTTPRedirectionLoop,
832
TestCaseWithTwoWebservers):
1152
833
"""Tests redirections for urllib implementation"""
835
_qualifier = 'urllib'
1154
836
_transport = HttpTransport_urllib
1156
def _qualified_url(self, host, port):
1157
result = 'http+urllib://%s:%s' % (host, port)
1158
self.permit_url(result)
1163
840
class TestHTTPRedirections_pycurl(TestWithTransport_pycurl,
1164
TestHTTPRedirections,
1165
http_utils.TestCaseWithTwoWebservers):
841
TestHTTPRedirectionLoop,
842
TestCaseWithTwoWebservers):
1166
843
"""Tests redirections for pycurl implementation"""
1168
def _qualified_url(self, host, port):
1169
result = 'http+pycurl://%s:%s' % (host, port)
1170
self.permit_url(result)
1174
class TestHTTPRedirections_nosmart(TestHTTPRedirections,
1175
http_utils.TestCaseWithTwoWebservers):
1176
"""Tests redirections for the nosmart decorator"""
1178
_transport = NoSmartTransportDecorator
1180
def _qualified_url(self, host, port):
1181
result = 'nosmart+http://%s:%s' % (host, port)
1182
self.permit_url(result)
1186
class TestHTTPRedirections_readonly(TestHTTPRedirections,
1187
http_utils.TestCaseWithTwoWebservers):
1188
"""Tests redirections for readonly decoratror"""
1190
_transport = ReadonlyTransportDecorator
1192
def _qualified_url(self, host, port):
1193
result = 'readonly+http://%s:%s' % (host, port)
1194
self.permit_url(result)
1198
class TestDotBzrHidden(TestCaseWithTransport):
1201
if sys.platform == 'win32':
1202
ls = [os.environ['COMSPEC'], '/C', 'dir', '/B']
1205
f = subprocess.Popen(self.ls, stdout=subprocess.PIPE,
1206
stderr=subprocess.PIPE)
1207
out, err = f.communicate()
1208
self.assertEqual(0, f.returncode, 'Calling %s failed: %s'
1210
return out.splitlines()
1212
def test_dot_bzr_hidden(self):
1213
if sys.platform == 'win32' and not win32utils.has_win32file:
1214
raise TestSkipped('unable to make file hidden without pywin32 library')
1215
b = bzrdir.BzrDir.create('.')
1216
self.build_tree(['a'])
1217
self.assertEquals(['a'], self.get_ls())
1219
def test_dot_bzr_hidden_with_url(self):
1220
if sys.platform == 'win32' and not win32utils.has_win32file:
1221
raise TestSkipped('unable to make file hidden without pywin32 library')
1222
b = bzrdir.BzrDir.create(urlutils.local_path_to_url('.'))
1223
self.build_tree(['a'])
1224
self.assertEquals(['a'], self.get_ls())
1227
class _TestBzrDirFormat(bzrdir.BzrDirMetaFormat1):
1228
"""Test BzrDirFormat implementation for TestBzrDirSprout."""
1230
def _open(self, transport):
1231
return _TestBzrDir(transport, self)
1234
class _TestBzrDir(bzrdir.BzrDirMeta1):
1235
"""Test BzrDir implementation for TestBzrDirSprout.
1237
When created a _TestBzrDir already has repository and a branch. The branch
1238
is a test double as well.
1241
def __init__(self, *args, **kwargs):
1242
super(_TestBzrDir, self).__init__(*args, **kwargs)
1243
self.test_branch = _TestBranch()
1244
self.test_branch.repository = self.create_repository()
1246
def open_branch(self, unsupported=False):
1247
return self.test_branch
1249
def cloning_metadir(self, require_stacking=False):
1250
return _TestBzrDirFormat()
1253
class _TestBranchFormat(bzrlib.branch.BranchFormat):
1254
"""Test Branch format for TestBzrDirSprout."""
1257
class _TestBranch(bzrlib.branch.Branch):
1258
"""Test Branch implementation for TestBzrDirSprout."""
1260
def __init__(self, *args, **kwargs):
1261
self._format = _TestBranchFormat()
1262
super(_TestBranch, self).__init__(*args, **kwargs)
1266
def sprout(self, *args, **kwargs):
1267
self.calls.append('sprout')
1268
return _TestBranch()
1270
def copy_content_into(self, destination, revision_id=None):
1271
self.calls.append('copy_content_into')
1273
def get_parent(self):
1276
def set_parent(self, parent):
1277
self._parent = parent
1280
class TestBzrDirSprout(TestCaseWithMemoryTransport):
1282
def test_sprout_uses_branch_sprout(self):
1283
"""BzrDir.sprout calls Branch.sprout.
1285
Usually, BzrDir.sprout should delegate to the branch's sprout method
1286
for part of the work. This allows the source branch to control the
1287
choice of format for the new branch.
1289
There are exceptions, but this tests avoids them:
1290
- if there's no branch in the source bzrdir,
1291
- or if the stacking has been requested and the format needs to be
1292
overridden to satisfy that.
1294
# Make an instrumented bzrdir.
1295
t = self.get_transport('source')
1297
source_bzrdir = _TestBzrDirFormat().initialize_on_transport(t)
1298
# The instrumented bzrdir has a test_branch attribute that logs calls
1299
# made to the branch contained in that bzrdir. Initially the test
1300
# branch exists but no calls have been made to it.
1301
self.assertEqual([], source_bzrdir.test_branch.calls)
1304
target_url = self.get_url('target')
1305
result = source_bzrdir.sprout(target_url, recurse='no')
1307
# The bzrdir called the branch's sprout method.
1308
self.assertSubset(['sprout'], source_bzrdir.test_branch.calls)
1310
def test_sprout_parent(self):
1311
grandparent_tree = self.make_branch('grandparent')
1312
parent = grandparent_tree.bzrdir.sprout('parent').open_branch()
1313
branch_tree = parent.bzrdir.sprout('branch').open_branch()
1314
self.assertContainsRe(branch_tree.get_parent(), '/parent/$')
1317
class TestBzrDirHooks(TestCaseWithMemoryTransport):
1319
def test_pre_open_called(self):
1321
bzrdir.BzrDir.hooks.install_named_hook('pre_open', calls.append, None)
1322
transport = self.get_transport('foo')
1323
url = transport.base
1324
self.assertRaises(errors.NotBranchError, bzrdir.BzrDir.open, url)
1325
self.assertEqual([transport.base], [t.base for t in calls])
1327
def test_pre_open_actual_exceptions_raised(self):
1329
def fail_once(transport):
1332
raise errors.BzrError("fail")
1333
bzrdir.BzrDir.hooks.install_named_hook('pre_open', fail_once, None)
1334
transport = self.get_transport('foo')
1335
url = transport.base
1336
err = self.assertRaises(errors.BzrError, bzrdir.BzrDir.open, url)
1337
self.assertEqual('fail', err._preformatted_string)
845
_qualifier = 'pycurl'