~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__known_graph.py

Add a NEWS entry and prepare submission.

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
37
37
        ('python-nocache', {'module': _known_graph_py, 'do_cache': False}),
38
38
    ]
39
39
    suite = loader.suiteClass()
40
 
    if compiled_known_graph_feature.available():
41
 
        scenarios.append(('C', {'module': compiled_known_graph_feature.module,
42
 
                                'do_cache': True}))
43
 
        caching_scenarios.append(
44
 
            ('C-nocache', {'module': compiled_known_graph_feature.module,
45
 
                           'do_cache': False}))
 
40
    if CompiledKnownGraphFeature.available():
 
41
        from bzrlib import _known_graph_pyx
 
42
        scenarios.append(('C', {'module': _known_graph_pyx, 'do_cache': True}))
 
43
        caching_scenarios.append(('C-nocache',
 
44
                          {'module': _known_graph_pyx, 'do_cache': False}))
46
45
    else:
47
46
        # the compiled module isn't available, so we add a failing test
48
47
        class FailWithoutFeature(tests.TestCase):
49
48
            def test_fail(self):
50
 
                self.requireFeature(compiled_known_graph_feature)
 
49
                self.requireFeature(CompiledKnownGraphFeature)
51
50
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
52
51
    # TestKnownGraphHeads needs to be permutated with and without caching.
53
52
    # All other TestKnownGraph tests only need to be tested across module
59
58
    return suite
60
59
 
61
60
 
62
 
compiled_known_graph_feature = tests.ModuleAvailableFeature(
63
 
                                    'bzrlib._known_graph_pyx')
 
61
class _CompiledKnownGraphFeature(tests.Feature):
 
62
 
 
63
    def _probe(self):
 
64
        try:
 
65
            import bzrlib._known_graph_pyx
 
66
        except ImportError:
 
67
            return False
 
68
        return True
 
69
 
 
70
    def feature_name(self):
 
71
        return 'bzrlib._known_graph_pyx'
 
72
 
 
73
CompiledKnownGraphFeature = _CompiledKnownGraphFeature()
64
74
 
65
75
 
66
76
#  a