[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner/importcheck.py - Ignore doctest-caused indirect imports.
Christian Theune
ct at gocept.com
Thu Jan 29 06:23:03 EST 2009
Log message for revision 95408:
- Ignore doctest-caused indirect imports.
- Use the module's id for caching the wrappers.
Changed:
U zope.testing/trunk/src/zope/testing/testrunner/importcheck.py
-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner/importcheck.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/importcheck.py 2009-01-29 11:17:53 UTC (rev 95407)
+++ zope.testing/trunk/src/zope/testing/testrunner/importcheck.py 2009-01-29 11:23:03 UTC (rev 95408)
@@ -40,6 +40,10 @@
if (import_mod, name, real_mod) in WHITELIST:
# No warning for things on the whitelist.
pass
+ elif real_mod in ['doctest', 'zope.testing.doctest']:
+ # doctest regularly sticks stuff somewhere else. We
+ # ignore those.
+ pass
elif import_mod == 'sys' and name in ['stdin', 'stdout']:
# Those are redirected regularly.
pass
@@ -89,13 +93,14 @@
fromlist=None):
result = ihooks.ModuleImporter.import_module(
self, name, globals=globals, locals=locals, fromlist=fromlist)
- if result.__name__ not in wrapper_cache:
+ if id(result) not in wrapper_cache:
checker = IndirectAttributeAccessChecker(result)
if not hasattr(result, '__all__'):
+ # Support * imports
checker.__all__ = [x for x in dir(result) if not
x.startswith('_')]
- wrapper_cache[result.__name__] = checker
- return wrapper_cache[result.__name__]
+ wrapper_cache[id(result)] = checker
+ return wrapper_cache[id(result)]
def import_it(self, partname, fqname, parent, force_load=0):
result = ihooks.ModuleImporter.import_it(self, partname, fqname,
More information about the Zope3-Checkins
mailing list