~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_btree_index.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-15 03:58:20 UTC
  • mfrom: (4963 +trunk)
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100115035820-ilb3t36swgzq6v1l
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        condition_isinstance(TestBTreeNodes))
44
44
    import bzrlib._btree_serializer_py as py_module
45
45
    scenarios = [('python', {'parse_btree': py_module})]
46
 
    if CompiledBtreeParserFeature.available():
47
 
        # Is there a way to do this that gets missing feature failures rather
48
 
        # than no indication to the user?
49
 
        import bzrlib._btree_serializer_pyx as c_module
50
 
        scenarios.append(('C', {'parse_btree': c_module}))
 
46
    if compiled_btreeparser_feature.available():
 
47
        scenarios.append(('C', {'parse_btree':
 
48
                                compiled_btreeparser_feature.module}))
51
49
    return multiply_tests(node_tests, scenarios, others)
52
50
 
53
51
 
54
 
class _CompiledBtreeParserFeature(tests.Feature):
55
 
    def _probe(self):
56
 
        try:
57
 
            import bzrlib._btree_serializer_pyx
58
 
        except ImportError:
59
 
            return False
60
 
        return True
61
 
 
62
 
    def feature_name(self):
63
 
        return 'bzrlib._btree_serializer_pyx'
64
 
 
65
 
CompiledBtreeParserFeature = _CompiledBtreeParserFeature()
 
52
compiled_btreeparser_feature = tests.ModuleAvailableFeature(
 
53
                                'bzrlib._btree_serializer_pyx')
66
54
 
67
55
 
68
56
class BTreeTestCase(TestCaseWithTransport):
1293
1281
    def test_exists(self):
1294
1282
        # This is just to let the user know if they don't have the feature
1295
1283
        # available
1296
 
        self.requireFeature(CompiledBtreeParserFeature)
 
1284
        self.requireFeature(compiled_btreeparser_feature)
1297
1285
 
1298
1286
 
1299
1287
class TestMultiBisectRight(tests.TestCase):