~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__rio.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:
27
27
    suite = loader.suiteClass()
28
28
    import bzrlib._rio_py as py_module
29
29
    scenarios = [('python', {'module': py_module})]
30
 
    if CompiledRioFeature.available():
31
 
        import bzrlib._rio_pyx as c_module
32
 
        scenarios.append(('C', {'module': c_module}))
 
30
    if compiled_rio_feature.available():
 
31
        scenarios.append(('C', {'module': compiled_rio_feature.module}))
33
32
    else:
34
33
        # the compiled module isn't available, so we add a failing test
35
34
        class FailWithoutFeature(tests.TestCase):
36
35
            def test_fail(self):
37
 
                self.requireFeature(CompiledRioFeature)
 
36
                self.requireFeature(compiled_rio_feature)
38
37
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
39
38
    tests.multiply_tests(standard_tests, scenarios, suite)
40
39
    return suite
41
40
 
42
41
 
43
 
class _CompiledRioFeature(tests.Feature):
44
 
 
45
 
    def _probe(self):
46
 
        try:
47
 
            import bzrlib._rio_pyx
48
 
        except ImportError:
49
 
            return False
50
 
        return True
51
 
 
52
 
    def feature_name(self):
53
 
        return 'bzrlib._rio_pyx'
54
 
 
55
 
CompiledRioFeature = _CompiledRioFeature()
 
42
compiled_rio_feature = tests.ModuleAvailableFeature('bzrlib._rio_pyx')
56
43
 
57
44
 
58
45
class TestValidTag(tests.TestCase):