~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Martin Pool
  • Date: 2010-10-08 09:45:26 UTC
  • mto: This revision was merged to the branch mainline in revision 5483.
  • Revision ID: mbp@sourcefrog.net-20101008094526-i4yru1zoy172m9xo
Delete test_http.load_tests, and just specify variations per test

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    )
53
53
from bzrlib.tests.variations import (
54
54
    TestVariation,
 
55
    load_tests_from_their_variations,
55
56
    multiply_tests_by_variations,
56
57
    multiply_tests_by_their_variations,
57
58
    )
69
70
    from bzrlib.transport.http._pycurl import PyCurlTransport
70
71
 
71
72
 
 
73
load_tests = load_tests_from_their_variations
 
74
 
 
75
 
72
76
class VaryByHttpClientImplementation(TestVariation):
73
77
    """Test the two libraries we can use, pycurl and urllib."""
74
78
 
154
158
        return activity_scenarios
155
159
 
156
160
 
157
 
def load_tests(standard_tests, module, loader):
158
 
    """Multiply tests for http clients and protocol versions."""
159
 
    result = loader.suiteClass()
160
 
 
161
 
    # one for each transport implementation
162
 
    t_tests, remaining_tests = tests.split_suite_by_condition(
163
 
        standard_tests, tests.condition_isinstance((
164
 
                TestHttpTransportRegistration,
165
 
                TestHttpTransportUrls,
166
 
                Test_redirected_to,
167
 
                )))
168
 
    multiply_tests_by_their_variations(t_tests, result)
169
 
 
170
 
    # some tests are parametrized by the protocol version only
171
 
    p_tests, remaining_tests = tests.split_suite_by_condition(
172
 
        remaining_tests, tests.condition_isinstance((
173
 
                TestAuthOnRedirected,
174
 
                )))
175
 
    multiply_tests_by_their_variations(p_tests, result)
176
 
 
177
 
    # each implementation tested with each HTTP version
178
 
    tp_tests, remaining_tests = tests.split_suite_by_condition(
179
 
        remaining_tests, tests.condition_isinstance((
180
 
                SmartHTTPTunnellingTest,
181
 
                TestDoCatchRedirections,
182
 
                TestHTTPConnections,
183
 
                TestHTTPRedirections,
184
 
                TestHTTPSilentRedirections,
185
 
                TestLimitedRangeRequestServer,
186
 
                TestPost,
187
 
                TestProxyHttpServer,
188
 
                TestRanges,
189
 
                TestSpecificRequestHandler,
190
 
                )))
191
 
    multiply_tests_by_their_variations(tp_tests, result) 
192
 
 
193
 
    # proxy auth: each auth scheme on all http versions on all implementations.
194
 
    tppa_tests, remaining_tests = tests.split_suite_by_condition(
195
 
        remaining_tests, tests.condition_isinstance((
196
 
                TestProxyAuth,
197
 
                )))
198
 
    multiply_tests_by_their_variations(tppa_tests, result)
199
 
 
200
 
    # auth: each auth scheme on all http versions on all implementations.
201
 
    tpa_tests, remaining_tests = tests.split_suite_by_condition(
202
 
        remaining_tests, tests.condition_isinstance((
203
 
                TestAuth,
204
 
                )))
205
 
    multiply_tests_by_their_variations(tpa_tests, result)
206
 
 
207
 
    # activity: on all http[s] versions on all implementations
208
 
    tpact_tests, remaining_tests = tests.split_suite_by_condition(
209
 
        remaining_tests, tests.condition_isinstance((
210
 
                TestActivity,
211
 
                )))
212
 
    multiply_tests_by_their_variations(tpact_tests, result) 
213
 
 
214
 
    # No parametrization for the remaining tests
215
 
    result.addTests(remaining_tests)
216
 
 
217
 
    return result
218
 
 
219
 
 
220
161
class FakeManager(object):
221
162
 
222
163
    def __init__(self):
2016
1957
    be able to predict the activity on the client socket.
2017
1958
    """
2018
1959
 
2019
 
    variations = [
2020
 
        VaryByHttpActivity(),
2021
 
        VaryByHttpProtocolVersion(),
2022
 
        ]
2023
 
 
2024
1960
    def setUp(self):
2025
1961
        tests.TestCase.setUp(self)
2026
1962
        self.server = self._activity_server(self._protocol_version)
2159
2095
 
2160
2096
class TestActivity(tests.TestCase, TestActivityMixin):
2161
2097
 
 
2098
    variations = [
 
2099
        VaryByHttpActivity(),
 
2100
        VaryByHttpProtocolVersion(),
 
2101
        ]
 
2102
 
2162
2103
    def setUp(self):
2163
2104
        TestActivityMixin.setUp(self)
2164
2105