~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 08:10:55 UTC
  • mto: This revision was merged to the branch mainline in revision 5483.
  • Revision ID: mbp@sourcefrog.net-20101008081055-xsv2cd0qcy3ba5mt
Split variations code to bzrlib.tests.variations

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    http_utils,
51
51
    test_server,
52
52
    )
 
53
from bzrlib.tests.variations import (
 
54
    TestVariation,
 
55
    multiply_tests_by_variations,
 
56
    )
53
57
from bzrlib.transport import (
54
58
    http,
55
59
    remote,
64
68
    from bzrlib.transport.http._pycurl import PyCurlTransport
65
69
 
66
70
 
67
 
class TestVariation(object):
68
 
    """Variations that can be applied to tests"""
69
 
 
70
 
    def scenarios(self):
71
 
        """Return a list of (name, params) tuples.
72
 
 
73
 
        All the tests subject to this varation will be repeated once per
74
 
        scenario.
75
 
        """
76
 
        raise NotImplementedError(self.scenarios)
77
 
 
78
 
 
79
71
class VaryByHttpClientImplementation(TestVariation):
80
72
    """Test the two libraries we can use, pycurl and urllib."""
81
73
 
161
153
        return activity_scenarios
162
154
 
163
155
 
164
 
 
165
 
 
166
156
def load_tests(standard_tests, module, loader):
167
157
    """Multiply tests for http clients and protocol versions."""
168
158
    result = loader.suiteClass()
174
164
                TestHttpTransportUrls,
175
165
                Test_redirected_to,
176
166
                )))
177
 
    tests.multiply_tests(
178
 
        t_tests, VaryByHttpClientImplementation().scenarios(), result)
 
167
    result.addTests(multiply_tests_by_variations(
 
168
        t_tests, [VaryByHttpClientImplementation()], loader))
179
169
 
180
170
    # some tests are parametrized by the protocol version only
181
171
    p_tests, remaining_tests = tests.split_suite_by_condition(