~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__annotator.py

  • Committer: Andrew Bennetts
  • Date: 2009-09-08 08:09:25 UTC
  • mto: (4634.6.27 2.0)
  • mto: This revision was merged to the branch mainline in revision 4680.
  • Revision ID: andrew.bennetts@canonical.com-20090908080925-ccmjw4kzzz7bepg7
Fix more tests to cope with new commit_write_group strictness.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010, 2011 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
18
18
 
19
19
from bzrlib import (
20
20
    annotate,
 
21
    _annotator_py,
21
22
    errors,
22
23
    knit,
23
24
    revision,
27
28
 
28
29
def load_tests(standard_tests, module, loader):
29
30
    """Parameterize tests for all versions of groupcompress."""
30
 
    suite, _ = tests.permute_tests_for_extension(standard_tests, loader,
31
 
        'bzrlib._annotator_py', 'bzrlib._annotator_pyx')
32
 
    return suite
 
31
    scenarios = [
 
32
        ('python', {'module': _annotator_py}),
 
33
    ]
 
34
    suite = loader.suiteClass()
 
35
    if CompiledAnnotator.available():
 
36
        from bzrlib import _annotator_pyx
 
37
        scenarios.append(('C', {'module': _annotator_pyx}))
 
38
    else:
 
39
        # the compiled module isn't available, so we add a failing test
 
40
        class FailWithoutFeature(tests.TestCase):
 
41
            def test_fail(self):
 
42
                self.requireFeature(CompiledAnnotator)
 
43
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
 
44
    result = tests.multiply_tests(standard_tests, scenarios, suite)
 
45
    return result
 
46
 
 
47
 
 
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()
33
61
 
34
62
 
35
63
class TestAnnotator(tests.TestCaseWithMemoryTransport):