~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2008-06-25 10:06:48 UTC
  • mfrom: (3509 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3510.
  • Revision ID: mbp@sourcefrog.net-20080625100648-ac20jxcm3ojucuby
merge trunk; remove RemoteToOtherFetcher

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
                           )
34
34
from bzrlib.remote import RemoteBranchFormat, RemoteBzrDirFormat
35
35
from bzrlib.smart.server import (
 
36
    ReadonlySmartTCPServer_for_testing,
 
37
    ReadonlySmartTCPServer_for_testing_v2_only,
36
38
    SmartTCPServer_for_testing,
37
 
    ReadonlySmartTCPServer_for_testing,
 
39
    SmartTCPServer_for_testing_v2_only,
38
40
    )
39
41
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
40
42
from bzrlib.transport.memory import MemoryServer
50
52
    """
51
53
 
52
54
    def __init__(self, transport_server, transport_readonly_server, formats,
53
 
        vfs_transport_factory=None):
 
55
        vfs_transport_factory=None, name_suffix=''):
54
56
        self._transport_server = transport_server
55
57
        self._transport_readonly_server = transport_readonly_server
 
58
        self._name_suffix = name_suffix
56
59
        self.scenarios = self.formats_to_scenarios(formats)
57
60
    
58
61
    def formats_to_scenarios(self, formats):
66
69
            # so we have a conditional here to handle them.
67
70
            scenario_name = getattr(branch_format, '__name__',
68
71
                branch_format.__class__.__name__)
 
72
            scenario_name += self._name_suffix
69
73
            scenario = (scenario_name, {
70
74
                "transport_server":self._transport_server,
71
75
                "transport_readonly_server":self._transport_readonly_server,
178
182
    # add the tests for the sub modules
179
183
    tests.adapt_modules(test_branch_implementations, adapter, loader, result)
180
184
 
 
185
    # Add RemoteBranch tests, which need a special server.
181
186
    adapt_to_smart_server = BranchTestProviderAdapter(
182
187
        SmartTCPServer_for_testing,
183
188
        ReadonlySmartTCPServer_for_testing,
184
189
        [(RemoteBranchFormat(), RemoteBzrDirFormat())],
185
 
        MemoryServer
186
 
        )
 
190
        MemoryServer,
 
191
        name_suffix='-default')
 
192
    tests.adapt_modules(test_branch_implementations,
 
193
                        adapt_to_smart_server,
 
194
                        loader,
 
195
                        result)
 
196
 
 
197
    # Also add tests for RemoteBranch with HPSS protocol v2 (i.e. bzr <1.6)
 
198
    # server.
 
199
    adapt_to_smart_server = BranchTestProviderAdapter(
 
200
        SmartTCPServer_for_testing_v2_only,
 
201
        ReadonlySmartTCPServer_for_testing_v2_only,
 
202
        [(RemoteBranchFormat(), RemoteBzrDirFormat())],
 
203
        MemoryServer,
 
204
        name_suffix='-v2')
187
205
    tests.adapt_modules(test_branch_implementations,
188
206
                        adapt_to_smart_server,
189
207
                        loader,