Rev 4921: Switch CompiledKnownGraph in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-module-available
John Arbash Meinel
john at arbash-meinel.com
Mon Dec 21 19:19:13 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-module-available
------------------------------------------------------------
revno: 4921
revision-id: john at arbash-meinel.com-20091221191904-pgo0y24x43npgajt
parent: john at arbash-meinel.com-20091221191710-82maxpu7hxsu09uy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-module-available
timestamp: Mon 2009-12-21 13:19:04 -0600
message:
Switch CompiledKnownGraph
-------------- next part --------------
=== modified file 'bzrlib/tests/test__known_graph.py'
--- a/bzrlib/tests/test__known_graph.py 2009-12-01 14:40:13 +0000
+++ b/bzrlib/tests/test__known_graph.py 2009-12-21 19:19:04 +0000
@@ -37,16 +37,17 @@
('python-nocache', {'module': _known_graph_py, 'do_cache': False}),
]
suite = loader.suiteClass()
- if CompiledKnownGraphFeature.available():
- from bzrlib import _known_graph_pyx
- scenarios.append(('C', {'module': _known_graph_pyx, 'do_cache': True}))
- caching_scenarios.append(('C-nocache',
- {'module': _known_graph_pyx, 'do_cache': False}))
+ if compiled_known_graph.available():
+ scenarios.append(('C', {'module': compiled_known_graph.module,
+ 'do_cache': True}))
+ caching_scenarios.append(
+ ('C-nocache', {'module': compiled_known_graph.module,
+ 'do_cache': False}))
else:
# the compiled module isn't available, so we add a failing test
class FailWithoutFeature(tests.TestCase):
def test_fail(self):
- self.requireFeature(CompiledKnownGraphFeature)
+ self.requireFeature(compiled_known_graph)
suite.addTest(loader.loadTestsFromTestCase(FailWithoutFeature))
# TestKnownGraphHeads needs to be permutated with and without caching.
# All other TestKnownGraph tests only need to be tested across module
@@ -58,19 +59,7 @@
return suite
-class _CompiledKnownGraphFeature(tests.Feature):
-
- def _probe(self):
- try:
- import bzrlib._known_graph_pyx
- except ImportError:
- return False
- return True
-
- def feature_name(self):
- return 'bzrlib._known_graph_pyx'
-
-CompiledKnownGraphFeature = _CompiledKnownGraphFeature()
+compiled_known_graph = tests.ModuleAvailableFeature('bzrlib._known_graph_pyx')
# a
More information about the bazaar-commits
mailing list