336
336
formats = [workingtree_4.WorkingTreeFormat4(),
337
workingtree_3.WorkingTreeFormat3(),]
338
scenarios = make_scenarios(server1, server2, formats)
337
workingtree_3.WorkingTreeFormat3(),
338
workingtree_4.WorkingTreeFormat6()]
339
scenarios = make_scenarios(server1, server2, formats,
340
remote_server='c', remote_readonly_server='d',
341
remote_backing_server='e')
339
342
self.assertEqual([
340
343
('WorkingTreeFormat4',
341
344
{'bzrdir_format': formats[0]._matchingbzrdir,
346
349
{'bzrdir_format': formats[1]._matchingbzrdir,
347
350
'transport_readonly_server': 'b',
348
351
'transport_server': 'a',
349
'workingtree_format': formats[1]})],
352
'workingtree_format': formats[1]}),
353
('WorkingTreeFormat6',
354
{'bzrdir_format': formats[2]._matchingbzrdir,
355
'transport_readonly_server': 'b',
356
'transport_server': 'a',
357
'workingtree_format': formats[2]}),
358
('WorkingTreeFormat6,remote',
359
{'bzrdir_format': formats[2]._matchingbzrdir,
360
'repo_is_remote': True,
361
'transport_readonly_server': 'd',
362
'transport_server': 'c',
363
'vfs_transport_factory': 'e',
364
'workingtree_format': formats[2]}),
353
368
class TestTreeScenarios(tests.TestCase):
355
370
def test_scenarios(self):
356
371
# the tree implementation scenario generator is meant to setup one
357
# instance for each working tree format, and one additional instance
372
# instance for each working tree format, one additional instance
358
373
# that will use the default wt format, but create a revision tree for
359
# the tests. this means that the wt ones should have the
360
# workingtree_to_test_tree attribute set to 'return_parameter' and the
361
# revision one set to revision_tree_from_workingtree.
374
# the tests, and one more that uses the default wt format as a
375
# lightweight checkout of a remote repository. This means that the wt
376
# ones should have the workingtree_to_test_tree attribute set to
377
# 'return_parameter' and the revision one set to
378
# revision_tree_from_workingtree.
363
380
from bzrlib.tests.per_tree import (
364
381
_dirstate_tree_from_workingtree,
390
smart_server = test_server.SmartTCPServer_for_testing
391
smart_readonly_server = test_server.ReadonlySmartTCPServer_for_testing
392
mem_server = memory.MemoryServer
373
393
formats = [workingtree_4.WorkingTreeFormat4(),
374
394
workingtree_3.WorkingTreeFormat3(),]
375
395
scenarios = make_scenarios(server1, server2, formats)
376
self.assertEqual(7, len(scenarios))
396
self.assertEqual(8, len(scenarios))
377
397
default_wt_format = workingtree.format_registry.get_default()
378
398
wt4_format = workingtree_4.WorkingTreeFormat4()
379
399
wt5_format = workingtree_4.WorkingTreeFormat5()
400
wt6_format = workingtree_4.WorkingTreeFormat6()
380
401
expected_scenarios = [
381
402
('WorkingTreeFormat4',
382
403
{'bzrdir_format': formats[0]._matchingbzrdir,
392
413
'workingtree_format': formats[1],
393
414
'_workingtree_to_test_tree': return_parameter,
416
('WorkingTreeFormat6,remote',
417
{'bzrdir_format': wt6_format._matchingbzrdir,
418
'repo_is_remote': True,
419
'transport_readonly_server': smart_readonly_server,
420
'transport_server': smart_server,
421
'vfs_transport_factory': mem_server,
422
'workingtree_format': wt6_format,
423
'_workingtree_to_test_tree': return_parameter,
396
426
{'_workingtree_to_test_tree': revision_tree_from_workingtree,
397
427
'bzrdir_format': default_wt_format._matchingbzrdir,