43
43
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
44
from bzrlib.tests.workingtree_implementations import (
45
WorkingTreeTestProviderAdapter,
44
47
from bzrlib.revisiontree import RevisionTree
45
48
from bzrlib.workingtree import (
47
50
WorkingTreeFormat3,
48
WorkingTreeTestProviderAdapter,
51
53
from bzrlib.workingtree_4 import (
289
291
class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
290
292
"""Generate test suites for each Tree implementation in bzrlib.
292
Currently this covers all working tree formats, and RevisionTree by
293
committing a working tree to create the revision tree.
294
Currently this covers all working tree formats, and RevisionTree and
295
DirStateRevisionTree by committing a working tree to create the revision
296
def adapt(self, test):
297
result = super(TreeTestProviderAdapter, self).adapt(test)
298
for adapted_test in result:
299
def __init__(self, transport_server, transport_readonly_server, formats):
300
super(TreeTestProviderAdapter, self).__init__(transport_server,
301
transport_readonly_server, formats)
302
# now adjust the scenarios and add the non-working-tree tree scenarios.
303
for scenario in self.scenarios:
299
304
# for working tree adapted tests, preserve the tree
300
adapted_test.workingtree_to_test_tree = return_parameter
301
# this is the default in that it's used to test the generic InterTree
305
scenario[1]["workingtree_to_test_tree"] = return_parameter
306
# add RevisionTree scenario
307
# this is the 'default format' in that it's used to test the generic InterTree
303
309
default_format = WorkingTreeFormat3()
304
revision_tree_test = self._clone_test(
306
default_format._matchingbzrdir,
308
RevisionTree.__name__)
309
revision_tree_test.workingtree_to_test_tree = revision_tree_from_workingtree
310
result.addTest(revision_tree_test)
311
# also explicity test WorkingTree4 against everything
310
self.scenarios.append(self.formats_to_scenarios([
311
(default_format, default_format._matchingbzrdir)])[0])
312
self.scenarios[-1] = (RevisionTree.__name__, self.scenarios[-1][1])
313
self.scenarios[-1][1]["workingtree_to_test_tree"] = revision_tree_from_workingtree
315
# also test WorkingTree4's RevisionTree implementation which is specialised.
312
316
dirstate_format = WorkingTreeFormat4()
313
dirstate_revision_tree_test = self._clone_test(
315
dirstate_format._matchingbzrdir,
317
DirStateRevisionTree.__name__)
318
dirstate_revision_tree_test.workingtree_to_test_tree = _dirstate_tree_from_workingtree
319
result.addTest(dirstate_revision_tree_test)
317
self.scenarios.append(self.formats_to_scenarios([
318
(dirstate_format, dirstate_format._matchingbzrdir)])[0])
319
self.scenarios[-1] = (DirStateRevisionTree.__name__, self.scenarios[-1][1])
320
self.scenarios[-1][1]["workingtree_to_test_tree"] = _dirstate_tree_from_workingtree
323
323
def test_suite():