~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__known_graph.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-12 22:36:23 UTC
  • mfrom: (4953 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4955.
  • Revision ID: john@arbash-meinel.com-20100112223623-836x5mou0gm5vsep
merge bzr.dev 4953 to clean up the ui factory issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        ('python-nocache', {'module': _known_graph_py, 'do_cache': False}),
38
38
    ]
39
39
    suite = loader.suiteClass()
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}))
 
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}))
45
46
    else:
46
47
        # the compiled module isn't available, so we add a failing test
47
48
        class FailWithoutFeature(tests.TestCase):
48
49
            def test_fail(self):
49
 
                self.requireFeature(CompiledKnownGraphFeature)
 
50
                self.requireFeature(compiled_known_graph_feature)
50
51
        suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
51
52
    # TestKnownGraphHeads needs to be permutated with and without caching.
52
53
    # All other TestKnownGraph tests only need to be tested across module
58
59
    return suite
59
60
 
60
61
 
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()
 
62
compiled_known_graph_feature = tests.ModuleAvailableFeature(
 
63
                                    'bzrlib._known_graph_pyx')
74
64
 
75
65
 
76
66
#  a