1
# Copyright (C) 2009, 2010 Canonical Ltd
1
# Copyright (C) 2009, 2010, 2011 Canonical Ltd
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
21
21
from bzrlib import (
27
26
from bzrlib.tests import test_graph
28
27
from bzrlib.revision import NULL_REVISION
31
def load_tests(standard_tests, module, loader):
32
"""Parameterize tests for all versions of groupcompress."""
28
from bzrlib.tests.scenarios import load_tests_apply_scenarios
31
def caching_scenarios():
34
33
('python', {'module': _known_graph_py, 'do_cache': True}),
37
('python-nocache', {'module': _known_graph_py, 'do_cache': False}),
39
suite = loader.suiteClass()
40
35
if compiled_known_graph_feature.available():
41
36
scenarios.append(('C', {'module': compiled_known_graph_feature.module,
42
37
'do_cache': True}))
43
caching_scenarios.append(
41
def non_caching_scenarios():
43
('python-nocache', {'module': _known_graph_py, 'do_cache': False}),
45
if compiled_known_graph_feature.available():
44
47
('C-nocache', {'module': compiled_known_graph_feature.module,
45
48
'do_cache': False}))
47
# the compiled module isn't available, so we add a failing test
48
class FailWithoutFeature(tests.TestCase):
50
self.requireFeature(compiled_known_graph_feature)
51
suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
52
# TestKnownGraphHeads needs to be permutated with and without caching.
53
# All other TestKnownGraph tests only need to be tested across module
54
heads_suite, other_suite = tests.split_suite_by_condition(
55
standard_tests, tests.condition_isinstance(TestKnownGraphHeads))
56
suite = tests.multiply_tests(other_suite, scenarios, suite)
57
suite = tests.multiply_tests(heads_suite, scenarios + caching_scenarios,
52
load_tests = load_tests_apply_scenarios
62
55
compiled_known_graph_feature = tests.ModuleAvailableFeature(
63
'bzrlib._known_graph_pyx')
56
'bzrlib._known_graph_pyx')