1
# Copyright (C) 2008 Canonical Ltd
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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 CompiledChunksToLinesFeature.available():
28
import bzrlib._chunks_to_lines_pyx as c_module
29
scenarios.append(('C', {'module': c_module}))
31
# the compiled module isn't available, so we add a failing test
32
class FailWithoutFeature(tests.TestCase):
34
self.requireFeature(CompiledChunksToLinesFeature)
35
standard_tests.addTest(FailWithoutFeature("test_fail"))
36
return tests.multiply_tests(standard_tests, scenarios, loader.suiteClass())
39
class _CompiledChunksToLinesFeature(tests.Feature):
43
import bzrlib._chunks_to_lines_pyx
48
def feature_name(self):
49
return 'bzrlib._chunks_to_lines_pyx'
51
CompiledChunksToLinesFeature = _CompiledChunksToLinesFeature()
24
suite, _ = tests.permute_tests_for_extension(
25
standard_tests, loader, 'bzrlib._chunks_to_lines_py',
26
'bzrlib._chunks_to_lines_pyx')
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
32
compiled_chunkstolines_feature = tests.ModuleAvailableFeature(
33
'bzrlib._chunks_to_lines_pyx')
54
36
class TestChunksToLines(tests.TestCase):