369
369
revision_tree_from_workingtree)
372
class TestInterTreeProviderAdapter(TestCase):
373
"""A group of tests that test the InterTreeTestAdapter."""
375
def test_adapted_tests(self):
376
# check that constructor parameters are passed through to the adapted
378
# for InterTree tests we want the machinery to bring up two trees in
379
# each instance: the base one, and the one we are interacting with.
380
# because each optimiser can be direction specific, we need to test
381
# each optimiser in its chosen direction.
382
# unlike the TestProviderAdapter we dont want to automatically add a
383
# parameterised one for WorkingTree - the optimisers will tell us what
385
from bzrlib.tests.tree_implementations import (
387
revision_tree_from_workingtree
389
from bzrlib.tests.intertree_implementations import (
390
InterTreeTestProviderAdapter,
392
from bzrlib.workingtree import WorkingTreeFormat2, WorkingTreeFormat3
393
input_test = TestInterTreeProviderAdapter(
394
"test_adapted_tests")
397
format1 = WorkingTreeFormat2()
398
format2 = WorkingTreeFormat3()
399
formats = [(str, format1, format2, False, True),
400
(int, format2, format1, False, True)]
401
adapter = InterTreeTestProviderAdapter(server1, server2, formats)
402
suite = adapter.adapt(input_test)
403
tests = list(iter(suite))
404
self.assertEqual(2, len(tests))
405
self.assertEqual(tests[0].intertree_class, formats[0][0])
406
self.assertEqual(tests[0].workingtree_format, formats[0][1])
407
self.assertEqual(tests[0].workingtree_to_test_tree, formats[0][2])
408
self.assertEqual(tests[0].workingtree_format_to, formats[0][3])
409
self.assertEqual(tests[0].workingtree_to_test_tree_to, formats[0][4])
410
self.assertEqual(tests[0].transport_server, server1)
411
self.assertEqual(tests[0].transport_readonly_server, server2)
412
self.assertEqual(tests[1].intertree_class, formats[1][0])
413
self.assertEqual(tests[1].workingtree_format, formats[1][1])
414
self.assertEqual(tests[1].workingtree_to_test_tree, formats[1][2])
415
self.assertEqual(tests[1].workingtree_format_to, formats[1][3])
416
self.assertEqual(tests[1].workingtree_to_test_tree_to, formats[1][4])
417
self.assertEqual(tests[1].transport_server, server1)
418
self.assertEqual(tests[1].transport_readonly_server, server2)
372
420
class TestTestCaseWithTransport(TestCaseWithTransport):
373
421
"""Tests for the convenience functions TestCaseWithTransport introduces."""