35
35
revision_tree_from_workingtree,
38
from bzrlib.tests.workingtree_implementations import (
39
WorkingTreeTestProviderAdapter,
38
41
from bzrlib.tree import InterTree
39
42
from bzrlib.workingtree import (
40
43
WorkingTreeFormat3,
41
WorkingTreeTestProviderAdapter,
61
63
class InterTreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
62
64
"""Generate test suites for each InterTree implementation in bzrlib."""
64
def adapt(self, test):
66
def formats_to_scenarios(self, formats):
67
"""Transform the input formats to a list of scenarios.
69
:param formats: A list of tuples:.
72
workingtree_format_to,
73
mutable_trees_to_test_trees)
66
76
for (intertree_class,
67
77
workingtree_format,
68
78
workingtree_format_to,
69
mutable_trees_to_test_trees) in self._formats:
70
new_test = self._clone_test(
72
workingtree_format._matchingbzrdir,
74
intertree_class.__name__)
75
new_test.intertree_class = intertree_class
76
new_test.workingtree_format_to = workingtree_format_to
77
# mutable_trees_to_test_trees takes two trees and converts them to
78
# whatever relationship the optimiser under test requires.
79
new_test.mutable_trees_to_test_trees = mutable_trees_to_test_trees
80
# workingtree_to_test_tree is set to disable changing individual
81
# trees: instead the mutable_trees_to_test_trees helper is used.
82
new_test.workingtree_to_test_tree = return_parameter
83
result.addTest(new_test)
79
mutable_trees_to_test_trees) in formats:
80
scenario = (intertree_class.__name__, {
81
"transport_server":self._transport_server,
82
"transport_readonly_server":self._transport_readonly_server,
83
"bzrdir_format":workingtree_format._matchingbzrdir,
84
"workingtree_format":workingtree_format,
85
"intertree_class":intertree_class,
86
"workingtree_format_to":workingtree_format_to,
87
# mutable_trees_to_test_trees takes two trees and converts them to,
88
# whatever relationship the optimiser under test requires.,
89
"mutable_trees_to_test_trees":mutable_trees_to_test_trees,
90
# workingtree_to_test_tree is set to disable changing individual,
91
# trees: instead the mutable_trees_to_test_trees helper is used.,
92
"workingtree_to_test_tree":return_parameter,
94
result.append(scenario)