~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__chk_map.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:
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_feature.available():
 
33
        scenarios.append(('C', {'module': compiled_chkmap_feature.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_feature)
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_feature = tests.ModuleAvailableFeature('bzrlib._chk_map_pyx')
58
45
 
59
46
 
60
47
class TestSearchKeys(tests.TestCase):