~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-11 01:56:37 UTC
  • mfrom: (4108.2.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090311015637-v73ocbv9bcexe4dm
(robertc) Factor branch scenario generation out of branch test
        loading. (Michael Hudson)

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
        return tree
131
131
 
132
132
 
 
133
def branch_scenarios():
 
134
    """ """
 
135
    # Generate a list of branch formats and their associated bzrdir formats to
 
136
    # use.
 
137
    combinations = [(format, format._matchingbzrdir) for format in
 
138
         BranchFormat._formats.values() + _legacy_formats]
 
139
    scenarios = make_scenarios(
 
140
        # None here will cause the default vfs transport server to be used.
 
141
        None,
 
142
        # None here will cause a readonly decorator to be created
 
143
        # by the TestCaseWithTransport.get_readonly_transport method.
 
144
        None,
 
145
        combinations)
 
146
    # Add RemoteBranch tests, which need a special server.
 
147
    remote_branch_format = RemoteBranchFormat()
 
148
    scenarios.extend(make_scenarios(
 
149
        SmartTCPServer_for_testing,
 
150
        ReadonlySmartTCPServer_for_testing,
 
151
        [(remote_branch_format, remote_branch_format._matchingbzrdir)],
 
152
        MemoryServer,
 
153
        name_suffix='-default'))
 
154
    # Also add tests for RemoteBranch with HPSS protocol v2 (i.e. bzr <1.6)
 
155
    # server.
 
156
    scenarios.extend(make_scenarios(
 
157
        SmartTCPServer_for_testing_v2_only,
 
158
        ReadonlySmartTCPServer_for_testing_v2_only,
 
159
        [(remote_branch_format, remote_branch_format._matchingbzrdir)],
 
160
        MemoryServer,
 
161
        name_suffix='-v2'))
 
162
    return scenarios
 
163
 
 
164
 
133
165
def load_tests(standard_tests, module, loader):
134
166
    test_branch_implementations = [
135
167
        'bzrlib.tests.branch_implementations.test_bound_sftp',
161
193
        'bzrlib.tests.branch_implementations.test_update',
162
194
        ]
163
195
    sub_tests = loader.loadTestsFromModuleNames(test_branch_implementations)
164
 
    # Generate a list of branch formats and their associated bzrdir formats to
165
 
    # use.
166
 
    combinations = [(format, format._matchingbzrdir) for format in
167
 
         BranchFormat._formats.values() + _legacy_formats]
168
 
    scenarios = make_scenarios(
169
 
        # None here will cause the default vfs transport server to be used.
170
 
        None,
171
 
        # None here will cause a readonly decorator to be created
172
 
        # by the TestCaseWithTransport.get_readonly_transport method.
173
 
        None,
174
 
        combinations)
175
 
    # Add RemoteBranch tests, which need a special server.
176
 
    remote_branch_format = RemoteBranchFormat()
177
 
    scenarios.extend(make_scenarios(
178
 
        SmartTCPServer_for_testing,
179
 
        ReadonlySmartTCPServer_for_testing,
180
 
        [(remote_branch_format, remote_branch_format._matchingbzrdir)],
181
 
        MemoryServer,
182
 
        name_suffix='-default'))
183
 
    # Also add tests for RemoteBranch with HPSS protocol v2 (i.e. bzr <1.6)
184
 
    # server.
185
 
    scenarios.extend(make_scenarios(
186
 
        SmartTCPServer_for_testing_v2_only,
187
 
        ReadonlySmartTCPServer_for_testing_v2_only,
188
 
        [(remote_branch_format, remote_branch_format._matchingbzrdir)],
189
 
        MemoryServer,
190
 
        name_suffix='-v2'))
191
 
    # add the tests for the sub modules
192
 
    return tests.multiply_tests(sub_tests, scenarios, standard_tests)
 
196
    return tests.multiply_tests(sub_tests, branch_scenarios(), standard_tests)