~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge with annotate

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    """
45
45
 
46
46
    def __init__(self, vfs_factory, transport_server, transport_readonly_server,
47
 
        formats):
 
47
        formats, name_suffix=''):
48
48
        """Create an object to adapt tests.
49
49
 
50
50
        :param vfs_server: A factory to create a Transport Server which has
53
53
        self._vfs_factory = vfs_factory
54
54
        self._transport_server = transport_server
55
55
        self._transport_readonly_server = transport_readonly_server
 
56
        self._name_suffix = name_suffix
56
57
        self.scenarios = self.formats_to_scenarios(formats)
57
58
    
58
59
    def formats_to_scenarios(self, formats):
62
63
        """
63
64
        result = []
64
65
        for format in formats:
65
 
            scenario = (format.__class__.__name__, {
 
66
            scenario_name = format.__class__.__name__
 
67
            scenario_name += self._name_suffix
 
68
            scenario = (scenario_name, {
66
69
                "vfs_transport_factory":self._vfs_factory,
67
70
                "transport_server":self._transport_server,
68
71
                "transport_readonly_server":self._transport_readonly_server,
112
115
    # This will always add the tests for smart server transport, regardless of
113
116
    # the --transport option the user specified to 'bzr selftest'.
114
117
    from bzrlib.smart.server import (
 
118
        ReadonlySmartTCPServer_for_testing,
 
119
        ReadonlySmartTCPServer_for_testing_v2_only,
115
120
        SmartTCPServer_for_testing,
116
 
        ReadonlySmartTCPServer_for_testing,
 
121
        SmartTCPServer_for_testing_v2_only,
117
122
        )
118
123
    from bzrlib.remote import RemoteBzrDirFormat
119
124
 
123
128
        MemoryServer,
124
129
        SmartTCPServer_for_testing,
125
130
        ReadonlySmartTCPServer_for_testing,
126
 
        [(RemoteBzrDirFormat())])
 
131
        [(RemoteBzrDirFormat())],
 
132
        name_suffix='-default')
 
133
    adapt_modules(test_bzrdir_implementations,
 
134
                  adapt_to_smart_server,
 
135
                  loader,
 
136
                  smart_server_suite)
 
137
    adapt_to_smart_server = BzrDirTestProviderAdapter(
 
138
        MemoryServer,
 
139
        SmartTCPServer_for_testing_v2_only,
 
140
        ReadonlySmartTCPServer_for_testing_v2_only,
 
141
        [(RemoteBzrDirFormat())],
 
142
        name_suffix='-v2')
127
143
    adapt_modules(test_bzrdir_implementations,
128
144
                  adapt_to_smart_server,
129
145
                  loader,