/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__annotator.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:
32
32
        ('python', {'module': _annotator_py}),
33
33
    ]
34
34
    suite = loader.suiteClass()
35
 
    if CompiledAnnotator.available():
36
 
        from bzrlib import _annotator_pyx
37
 
        scenarios.append(('C', {'module': _annotator_pyx}))
 
35
    if compiled_annotator_feature.available():
 
36
        scenarios.append(('C', {'module': compiled_annotator_feature.module}))
38
37
    else:
39
38
        # the compiled module isn't available, so we add a failing test
40
39
        class FailWithoutFeature(tests.TestCase):
41
40
            def test_fail(self):
42
 
                self.requireFeature(CompiledAnnotator)
 
41
                self.requireFeature(compiled_annotator_feature)
43
42
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
44
43
    result = tests.multiply_tests(standard_tests, scenarios, suite)
45
44
    return result
46
45
 
47
46
 
48
 
class _CompiledAnnotator(tests.Feature):
49
 
 
50
 
    def _probe(self):
51
 
        try:
52
 
            import bzrlib._annotator_pyx
53
 
        except ImportError:
54
 
            return False
55
 
        return True
56
 
 
57
 
    def feature_name(self):
58
 
        return 'bzrlib._annotator_pyx'
59
 
 
60
 
CompiledAnnotator = _CompiledAnnotator()
 
47
compiled_annotator_feature = tests.ModuleAvailableFeature(
 
48
                                'bzrlib._annotator_pyx')
61
49
 
62
50
 
63
51
class TestAnnotator(tests.TestCaseWithMemoryTransport):