/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:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
28
28
 
29
29
def load_tests(standard_tests, module, loader):
30
30
    """Parameterize tests for all versions of groupcompress."""
31
 
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
32
 
        'bzrlib._annotator_py', 'bzrlib._annotator_pyx')
33
 
    return suite
 
31
    scenarios = [
 
32
        ('python', {'module': _annotator_py}),
 
33
    ]
 
34
    suite = loader.suiteClass()
 
35
    if compiled_annotator_feature.available():
 
36
        scenarios.append(('C', {'module': compiled_annotator_feature.module}))
 
37
    else:
 
38
        # the compiled module isn't available, so we add a failing test
 
39
        class FailWithoutFeature(tests.TestCase):
 
40
            def test_fail(self):
 
41
                self.requireFeature(compiled_annotator_feature)
 
42
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
 
43
    result = tests.multiply_tests(standard_tests, scenarios, suite)
 
44
    return result
 
45
 
 
46
 
 
47
compiled_annotator_feature = tests.ModuleAvailableFeature(
 
48
                                'bzrlib._annotator_pyx')
34
49
 
35
50
 
36
51
class TestAnnotator(tests.TestCaseWithMemoryTransport):