~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__chunks_to_lines.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-22 18:18:20 UTC
  • mfrom: (4913.2.26 2.1.0rc1-module-available)
  • Revision ID: pqm@pqm.ubuntu.com-20091222181820-qfolh2sy2nevoxxj
(jam) Switch many test features over to ModuleAvailable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    # parameterize all tests in this module
25
25
    import bzrlib._chunks_to_lines_py as py_module
26
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}))
 
27
    if compiled_chunkstolines_feature.available():
 
28
        scenarios.append(('C', {'module':
 
29
                                compiled_chunkstolines_feature.module}))
30
30
    else:
31
31
        # the compiled module isn't available, so we add a failing test
32
32
        class FailWithoutFeature(tests.TestCase):
33
33
            def test_fail(self):
34
 
                self.requireFeature(CompiledChunksToLinesFeature)
 
34
                self.requireFeature(compiled_chunkstolines_feature)
35
35
        standard_tests.addTest(FailWithoutFeature("test_fail"))
36
36
    return tests.multiply_tests(standard_tests, scenarios, loader.suiteClass())
37
37
 
38
38
 
39
 
class _CompiledChunksToLinesFeature(tests.Feature):
40
 
 
41
 
    def _probe(self):
42
 
        try:
43
 
            import bzrlib._chunks_to_lines_pyx
44
 
        except ImportError:
45
 
            return False
46
 
        return True
47
 
 
48
 
    def feature_name(self):
49
 
        return 'bzrlib._chunks_to_lines_pyx'
50
 
 
51
 
CompiledChunksToLinesFeature = _CompiledChunksToLinesFeature()
 
39
compiled_chunkstolines_feature = tests.ModuleAvailableFeature(
 
40
                                    'bzrlib._chunks_to_lines_pyx')
52
41
 
53
42
 
54
43
class TestChunksToLines(tests.TestCase):