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

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


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

------------------------------------------------------------
revno: 4920
revision-id: john at arbash-meinel.com-20091221191710-82maxpu7hxsu09uy
parent: john at arbash-meinel.com-20091221180349-ssqnzqygpynxz4sf
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-module-available
timestamp: Mon 2009-12-21 13:17:10 -0600
message:
  Switch CompiledStaticTuple
-------------- next part --------------
=== modified file 'bzrlib/tests/test__static_tuple.py'
--- a/bzrlib/tests/test__static_tuple.py	2009-11-28 21:54:08 +0000
+++ b/bzrlib/tests/test__static_tuple.py	2009-12-21 19:17:10 +0000
@@ -36,32 +36,19 @@
         ('python', {'module': _static_tuple_py}),
     ]
     suite = loader.suiteClass()
-    if CompiledStaticTuple.available():
-        from bzrlib import _static_tuple_c
-        scenarios.append(('C', {'module': _static_tuple_c}))
+    if compiled_static_tuple.available():
+        scenarios.append(('C', {'module': compiled_static_tuple.module}))
     else:
         # the compiled module isn't available, so we add a failing test
         class FailWithoutFeature(tests.TestCase):
             def test_fail(self):
-                self.requireFeature(CompiledStaticTuple)
+                self.requireFeature(compiled_static_tuple)
         suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
     result = tests.multiply_tests(standard_tests, scenarios, suite)
     return result
 
 
-class _CompiledStaticTuple(tests.Feature):
-
-    def _probe(self):
-        try:
-            import bzrlib._static_tuple_c
-        except ImportError:
-            return False
-        return True
-
-    def feature_name(self):
-        return 'bzrlib._static_tuple_c'
-
-CompiledStaticTuple = _CompiledStaticTuple()
+compiled_static_tuple = tests.ModuleAvailableFeature('bzrlib._static_tuple_c')
 
 
 class _Meliae(tests.Feature):
@@ -641,7 +628,7 @@
         # Make sure the right implementation is available from
         # bzrlib.static_tuple.StaticTuple.
         if self.module is _static_tuple_py:
-            if CompiledStaticTuple.available():
+            if compiled_static_tuple.available():
                 # We will be using the C version
                 return
         self.assertIs(static_tuple.StaticTuple,



More information about the bazaar-commits mailing list