~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__chunks_to_lines.py

(jam) Add bzrlib.tests.permute_for_extension to simplify extension
        testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
 
23
23
def load_tests(standard_tests, module, loader):
24
 
    # parameterize all tests in this module
25
 
    import bzrlib._chunks_to_lines_py as py_module
26
 
    scenarios = [('python', {'module': py_module})]
27
 
    if compiled_chunkstolines_feature.available():
28
 
        scenarios.append(('C', {'module':
29
 
                                compiled_chunkstolines_feature.module}))
30
 
    else:
31
 
        # the compiled module isn't available, so we add a failing test
32
 
        class FailWithoutFeature(tests.TestCase):
33
 
            def test_fail(self):
34
 
                self.requireFeature(compiled_chunkstolines_feature)
35
 
        standard_tests.addTest(FailWithoutFeature("test_fail"))
36
 
    return tests.multiply_tests(standard_tests, scenarios, loader.suiteClass())
37
 
 
38
 
 
 
24
    suite, _ = tests.permute_tests_for_extension(
 
25
        standard_tests, loader, 'bzrlib._chunks_to_lines_py',
 
26
        'bzrlib._chunks_to_lines_pyx')
 
27
    return suite
 
28
 
 
29
# test_osutils depends on this feature being around. We can't just use the one
 
30
# generated by load_tests, because if we only load osutils but not this module,
 
31
# then that code never gets run
39
32
compiled_chunkstolines_feature = tests.ModuleAvailableFeature(
40
33
                                    'bzrlib._chunks_to_lines_pyx')
41
34