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

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


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

------------------------------------------------------------
revno: 4922
revision-id: john at arbash-meinel.com-20091221192003-a38rg872bgvlmj3c
parent: john at arbash-meinel.com-20091221191904-pgo0y24x43npgajt
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-module-available
timestamp: Mon 2009-12-21 13:20:03 -0600
message:
  Switch CompiledRio
-------------- next part --------------
=== modified file 'bzrlib/tests/test__rio.py'
--- a/bzrlib/tests/test__rio.py	2009-05-14 21:29:57 +0000
+++ b/bzrlib/tests/test__rio.py	2009-12-21 19:20:03 +0000
@@ -27,32 +27,19 @@
     suite = loader.suiteClass()
     import bzrlib._rio_py as py_module
     scenarios = [('python', {'module': py_module})]
-    if CompiledRioFeature.available():
-        import bzrlib._rio_pyx as c_module
-        scenarios.append(('C', {'module': c_module}))
+    if compiled_rio.available():
+        scenarios.append(('C', {'module': compiled_rio.module}))
     else:
         # the compiled module isn't available, so we add a failing test
         class FailWithoutFeature(tests.TestCase):
             def test_fail(self):
-                self.requireFeature(CompiledRioFeature)
+                self.requireFeature(compiled_rio)
         suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
     tests.multiply_tests(standard_tests, scenarios, suite)
     return suite
 
 
-class _CompiledRioFeature(tests.Feature):
-
-    def _probe(self):
-        try:
-            import bzrlib._rio_pyx
-        except ImportError:
-            return False
-        return True
-
-    def feature_name(self):
-        return 'bzrlib._rio_pyx'
-
-CompiledRioFeature = _CompiledRioFeature()
+compiled_rio = tests.ModuleAvailableFeature('bzrlib._rio_pyx')
 
 
 class TestValidTag(tests.TestCase):



More information about the bazaar-commits mailing list