Rev 4925: Switch CompiledBtreeParserFeature in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-module-available

John Arbash Meinel john at arbash-meinel.com
Mon Dec 21 19:43:59 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-module-available

------------------------------------------------------------
revno: 4925
revision-id: john at arbash-meinel.com-20091221194351-vpq6u93etd6o9st9
parent: john at arbash-meinel.com-20091221194138-pmi7ygnbg69ijxcb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-module-available
timestamp: Mon 2009-12-21 13:43:51 -0600
message:
  Switch CompiledBtreeParserFeature
-------------- next part --------------
=== modified file 'bzrlib/tests/test_btree_index.py'
--- a/bzrlib/tests/test_btree_index.py	2009-11-07 01:58:11 +0000
+++ b/bzrlib/tests/test_btree_index.py	2009-12-21 19:43:51 +0000
@@ -43,26 +43,13 @@
         condition_isinstance(TestBTreeNodes))
     import bzrlib._btree_serializer_py as py_module
     scenarios = [('python', {'parse_btree': py_module})]
-    if CompiledBtreeParserFeature.available():
-        # Is there a way to do this that gets missing feature failures rather
-        # than no indication to the user?
-        import bzrlib._btree_serializer_pyx as c_module
-        scenarios.append(('C', {'parse_btree': c_module}))
+    if compiled_btreeparser.available():
+        scenarios.append(('C', {'parse_btree': compiled_btreeparser.module}))
     return multiply_tests(node_tests, scenarios, others)
 
 
-class _CompiledBtreeParserFeature(tests.Feature):
-    def _probe(self):
-        try:
-            import bzrlib._btree_serializer_pyx
-        except ImportError:
-            return False
-        return True
-
-    def feature_name(self):
-        return 'bzrlib._btree_serializer_pyx'
-
-CompiledBtreeParserFeature = _CompiledBtreeParserFeature()
+compiled_btreeparser = tests.ModuleAvailableFeature(
+                            'bzrlib._btree_serializer_pyx')
 
 
 class BTreeTestCase(TestCaseWithTransport):
@@ -1293,7 +1280,7 @@
     def test_exists(self):
         # This is just to let the user know if they don't have the feature
         # available
-        self.requireFeature(CompiledBtreeParserFeature)
+        self.requireFeature(compiled_btreeparser)
 
 
 class TestMultiBisectRight(tests.TestCase):



More information about the bazaar-commits mailing list