/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__chk_map.py

Switch CHKMap to use ModuleAvailableFeature

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    suite = loader.suiteClass()
30
30
    import bzrlib._chk_map_py as py_module
31
31
    scenarios = [('python', {'module': py_module})]
32
 
    if CompiledChkMapFeature.available():
33
 
        import bzrlib._chk_map_pyx as c_module
34
 
        scenarios.append(('C', {'module': c_module}))
 
32
    if compiled_chkmap.available():
 
33
        scenarios.append(('C', {'module': compiled_chkmap.module}))
35
34
    else:
36
35
        # the compiled module isn't available, so we add a failing test
37
36
        class FailWithoutFeature(tests.TestCase):
38
37
            def test_fail(self):
39
 
                self.requireFeature(CompiledChkMapFeature)
 
38
                self.requireFeature(compiled_chkmap)
40
39
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
41
40
    tests.multiply_tests(standard_tests, scenarios, suite)
42
41
    return suite
43
42
 
44
43
 
45
 
class _CompiledChkMapFeature(tests.Feature):
46
 
 
47
 
    def _probe(self):
48
 
        try:
49
 
            import bzrlib._chk_map_pyx
50
 
        except ImportError:
51
 
            return False
52
 
        return True
53
 
 
54
 
    def feature_name(self):
55
 
        return 'bzrlib._chk_map_pyx'
56
 
 
57
 
CompiledChkMapFeature = _CompiledChkMapFeature()
 
44
compiled_chkmap = tests.ModuleAvailableFeature('bzrlib._chk_map_pyx')
58
45
 
59
46
 
60
47
class TestSearchKeys(tests.TestCase):