[Zope3-dev] Re: import failure in zope.app.broken tests

Baiju M mbaiju at zeomega.com
Tue Feb 20 09:26:23 EST 2007


Philipp von Weitershausen wrote:

> Baiju M wrote:
>
>> Hi,
>>     There is an import failure when running 'python2.4 test.py -s 
>> zope.app.broken'
>> I have a fix here: http://zope3.pastey.net/6899
>> Commit it ?
>
>
> What's causing the failure?


This is the output I am getting when running: python2.4 test.py -s 
zope.app.broken

  Running tests at level 1
  Test-module import failures:

  Module: zope.app.broken.tests

  ImportError: cannot import name IBroken


  Total: 0 tests, 0 failures, 0 errors

  Test-modules with import problems:
    zope.app.broken.tests


In broken.py we are importing IAnnotations before IBroken definition
So the import cycle is like this:

(Pdb) where
...
  /var/tmp/wa/Zope3trunk/src/zope/app/broken/broken.py(26)?()
-> from zope.annotation.interfaces import IAnnotations
  /var/tmp/wa/Zope3trunk/src/zope/annotation/__init__.py(20)?()
-> from zope.annotation.factory import factory
  /var/tmp/wa/Zope3trunk/src/zope/annotation/factory.py(21)?()
-> import zope.app.container.contained
 > /var/tmp/wa/Zope3trunk/src/zope/app/container/contained.py(41)?()
-> from zope.app.broken.broken import IBroken
(Pdb) next
ImportError: 'cannot import name IBroken'


> And how does your patch fix it?

In broken.py define IBroken before importing IAnnotations
Also I moved the original defintion of IBroken to zope.app.broken.interfaces

Regards,
Baiju M



More information about the Zope3-dev mailing list