/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/__init__.py

Merge bzr.dev r3466

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.tests import (
28
28
                          adapt_modules,
29
29
                          default_transport,
30
 
                          TestLoader,
31
30
                          TestScenarioApplier,
32
 
                          TestSuite,
33
31
                          )
34
32
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
35
33
from bzrlib.workingtree import (WorkingTreeFormat,
50
48
        self._transport_server = transport_server
51
49
        self._transport_readonly_server = transport_readonly_server
52
50
        self.scenarios = self.formats_to_scenarios(formats)
53
 
    
 
51
 
54
52
    def formats_to_scenarios(self, formats):
55
53
        """Transform the input formats to a list of scenarios.
56
54
 
57
55
        :param formats: A list of (workingtree_format, bzrdir_format).
58
56
        """
59
 
    
 
57
 
60
58
        result = []
61
59
        for workingtree_format, bzrdir_format in formats:
62
 
            scenario = (workingtree_format.__class__.__name__, {
63
 
                "transport_server":self._transport_server,
64
 
                "transport_readonly_server":self._transport_readonly_server,
65
 
                "bzrdir_format":bzrdir_format,
66
 
                "workingtree_format":workingtree_format,
67
 
                })
68
 
            result.append(scenario)
 
60
            result.append(self.create_scenario(workingtree_format,
 
61
                          bzrdir_format))
69
62
        return result
70
63
 
 
64
    def create_scenario(self, workingtree_format, bzrdir_format):
 
65
        """Create a scenario for the specified converter
 
66
 
 
67
        :param workingtree_format: The particular workingtree format to test.
 
68
        :param bzrdir_format: The bzrdir format to test.
 
69
        :return: a (name, options) tuple, where options is a dict of values
 
70
            to be used as members of the TestCase.
 
71
        """
 
72
        scenario_options = {
 
73
            "transport_server": self._transport_server,
 
74
            "transport_readonly_server": self._transport_readonly_server,
 
75
            "bzrdir_format": bzrdir_format,
 
76
            "workingtree_format": workingtree_format,
 
77
            }
 
78
        return workingtree_format.__class__.__name__, scenario_options
 
79
 
71
80
 
72
81
class TestCaseWithWorkingTree(TestCaseWithBzrDir):
73
82
 
78
87
        return self.workingtree_format.initialize(made_control)
79
88
 
80
89
 
81
 
def test_suite():
82
 
    result = TestSuite()
 
90
def load_tests(basic_tests, module, loader):
 
91
    result = loader.suiteClass()
 
92
    # add the tests for this module
 
93
    result.addTests(basic_tests)
 
94
 
83
95
    test_workingtree_implementations = [
84
96
        'bzrlib.tests.workingtree_implementations.test_add_reference',
85
97
        'bzrlib.tests.workingtree_implementations.test_add',
116
128
        'bzrlib.tests.workingtree_implementations.test_walkdirs',
117
129
        'bzrlib.tests.workingtree_implementations.test_workingtree',
118
130
        ]
 
131
 
119
132
    adapter = WorkingTreeTestProviderAdapter(
120
133
        default_transport,
121
134
        # None here will cause a readonly decorator to be created
122
135
        # by the TestCaseWithTransport.get_readonly_transport method.
123
136
        None,
124
 
        [(format, format._matchingbzrdir) for format in 
 
137
        [(format, format._matchingbzrdir) for format in
125
138
         WorkingTreeFormat._formats.values() + _legacy_formats])
126
 
    loader = TestLoader()
 
139
 
 
140
    # add the tests for the sub modules
127
141
    adapt_modules(test_workingtree_implementations, adapter, loader, result)
128
142
    return result