Rev 5645: Rework the fix taking mgz remarks into account and rebasing against trunk. in file:///home/vila/src/bzr/bugs/712474-module-available/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Aug 16 14:14:39 UTC 2011
At file:///home/vila/src/bzr/bugs/712474-module-available/
------------------------------------------------------------
revno: 5645
revision-id: v.ladeuil+lp at free.fr-20110816141439-8k6q1gopgm5feigp
parent: v.ladeuil+lp at free.fr-20110816131240-gcyn9cik86dxwgz3
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 712474-module-available
timestamp: Tue 2011-08-16 16:14:39 +0200
message:
Rework the fix taking mgz remarks into account and rebasing against trunk.
-------------- next part --------------
=== modified file 'bzrlib/tests/features.py'
--- a/bzrlib/tests/features.py 2011-08-11 10:09:27 +0000
+++ b/bzrlib/tests/features.py 2011-08-16 14:14:39 +0000
@@ -166,11 +166,17 @@
self.module_name = module_name
def _probe(self):
- try:
- self._module = __import__(self.module_name, {}, {}, [''])
+ sentinel = object()
+ module = sys.modules.get(self.module_name, sentinel)
+ if module is sentinel:
+ try:
+ self._module = __import__(self.module_name, {}, {}, [''])
+ return True
+ except ImportError:
+ return False
+ else:
+ self._module = module
return True
- except ImportError:
- return False
@property
def module(self):
More information about the bazaar-commits
mailing list