128
128
def test_get_transport_permutations(self):
129
# this checks that we the module get_test_permutations call
130
# is made by the adapter get_transport_test_permitations method.
129
# this checks that get_test_permutations defined by the module is
130
# called by the adapter get_transport_test_permutations method.
131
131
class MockModule(object):
132
132
def get_test_permutations(self):
133
133
return sample_permutation
139
139
adapter.get_transport_test_permutations(MockModule()))
141
141
def test_adapter_checks_all_modules(self):
142
# this checks that the adapter returns as many permurtations as
143
# there are in all the registered# transport modules for there
144
# - we assume if this matches its probably doing the right thing
145
# especially in combination with the tests for setting the right
142
# this checks that the adapter returns as many permutations as there
143
# are in all the registered transport modules - we assume if this
144
# matches its probably doing the right thing especially in combination
145
# with the tests for setting the right classes below.
147
146
from bzrlib.tests.test_transport_implementations \
148
147
import TransportTestProviderAdapter
149
148
from bzrlib.transport import _get_transport_modules
235
234
adapter.scenarios)
238
class TestRepositoryProviderAdapter(TestCase):
237
class TestRepositoryParameterisation(TestCase):
239
238
"""A group of tests that test the repository implementation test adapter."""
241
def test_constructor(self):
242
# check that constructor parameters are passed through to the
244
from bzrlib.tests.repository_implementations import RepositoryTestProviderAdapter
247
formats = [("c", "C"), ("d", "D")]
248
adapter = RepositoryTestProviderAdapter(server1, server2, formats)
251
{'bzrdir_format': 'C',
252
'repository_format': 'c',
253
'transport_readonly_server': 'b',
254
'transport_server': 'a'}),
256
{'bzrdir_format': 'D',
257
'repository_format': 'd',
258
'transport_readonly_server': 'b',
259
'transport_server': 'a'})],
262
240
def test_setting_vfs_transport(self):
263
241
"""The vfs_transport_factory can be set optionally."""
264
from bzrlib.tests.repository_implementations import RepositoryTestProviderAdapter
265
formats = [("a", "b"), ("c", "d")]
266
adapter = RepositoryTestProviderAdapter(None, None, formats,
242
from bzrlib.tests.repository_implementations import formats_to_scenarios
243
scenarios = formats_to_scenarios(
244
[("a", "b"), ("c", "d")],
267
247
vfs_transport_factory="vfs")
268
248
self.assertEqual([
278
258
'transport_readonly_server': None,
279
259
'transport_server': None,
280
260
'vfs_transport_factory': 'vfs'})],
283
263
def test_formats_to_scenarios(self):
284
264
"""The adapter can generate all the scenarios needed."""
285
from bzrlib.tests.repository_implementations import RepositoryTestProviderAdapter
286
no_vfs_adapter = RepositoryTestProviderAdapter("server", "readonly",
288
vfs_adapter = RepositoryTestProviderAdapter("server", "readonly",
289
[], vfs_transport_factory="vfs")
265
from bzrlib.tests.repository_implementations import formats_to_scenarios
266
formats = [("c", "C"), (1, "D")]
267
no_vfs_scenarios = formats_to_scenarios(formats, "server", "readonly",
269
vfs_scenarios = formats_to_scenarios(formats, "server", "readonly",
270
vfs_transport_factory="vfs")
290
271
# no_vfs generate scenarios without vfs_transport_factor
291
formats = [("c", "C"), (1, "D")]
292
272
self.assertEqual([
294
274
{'bzrdir_format': 'C',
314
294
'transport_readonly_server': 'readonly',
315
295
'transport_server': 'server',
316
296
'vfs_transport_factory': 'vfs'})],
317
vfs_adapter.formats_to_scenarios(formats))
320
300
class TestTestScenarioApplier(TestCase):
1050
1030
self.assertEqual(None, result._extractBenchmarkTime(test))
1033
class TestUnicodeFilenameFeature(TestCase):
1035
def test_probe_passes(self):
1036
"""UnicodeFilenameFeature._probe passes."""
1037
# We can't test much more than that because the behaviour depends
1039
tests.UnicodeFilenameFeature._probe()
1053
1042
class TestRunner(TestCase):
1055
1044
def dummy_test(self):