[Zope-Coders] __import__ misery

Chris Withers chrisw@nipltd.com
Wed, 23 Jan 2002 14:38:18 +0000


Hi,

I thought about tidying up CMFCore/tests/test_all.py which currently contains a
load of duplicate and what should be unnecessary code.

However, I can't do it in the way I'd like 'cos __import__ is being unhelpful...

In test_all.py, the following works fine:
import test_ContentTypeRegistry

But the following barfs:
__import__('test_ContentTypeRegistry')

Traceback (most recent call last):
  File "E:\Zope\cmf_dev\Products\all_cmf_tests.py", line 4, in ?
    from Products.CMFCore.tests import test_all
  File "E:\Zope\cmf_dev\Products\CMFCore\tests\test_all.py", line 5, in ?
    __import__('test_ContentTypeRegistry')
ImportError: No module named test_ContentTypeRegistry

Can someone enlighten me as to WTF is going on?

cheers,

Chris