[Zope] Installing TextIndexNG3 in ZopeTestCase (long story short)

Peter Bengtsson peter at fry-it.com
Mon Feb 4 08:04:57 EST 2008


I've had a morning of annoyed frustration on trying to get TextIndexNG3 
to install properly in ZopeTestCase.
The problem I described in
http://www.nabble.com/ZopeTestCase.installProduct%28%27TextIndexNG3%27%29-trouble-to12403238.html#a12403356
mysteriously went away some time ago without any reasonable explaination.
Now I've created a new product which relies on the old troublemaker and 
it starts like this:

ZopeTestCase.installProduct('ZPsycopgDA')
ZopeTestCase.installProduct('PlacelessTranslationService')
ZopeTestCase.installProduct('ZCatalog')
ZopeTestCase.installProduct('ZCTextIndex')
ZopeTestCase.installProduct('Five')
ZopeTestCase.installProduct('TextIndexNG3')
ZopeTestCase.installProduct('Mest2')
ZopeTestCase.installProduct('Design2Mest')
ZopeTestCase.installProduct('MailHost')
ZopeTestCase.installProduct('Photo')

This works when running the tests of Mest2/tests!
Mest2 depends on Photo but the ZopeTestCase is clever enough to solve 
that dependency challange and TextIndexNG3 depends on Five but it works 
that out too.


Now in Design2Mest/test I copied the above lines and wrote a few basic 
tests and now it no longer works!!! TextIndexNG3 complains (again) about 
some parsers not being available. What happened was kind of that none of 
the zcml files of TextIndexNG3 were read or parsed at all.
The solution to the problem was to rearrange the order of...:
ZopeTestCase.installProduct('Five')
ZopeTestCase.installProduct('TextIndexNG3')
...to this...:
ZopeTestCase.installProduct('TextIndexNG3')
ZopeTestCase.installProduct('Five')
...and then it worked.


Lessons learnt:

  * Five and TextIndexNG3's importing order is very sensitive  in
    ZopeTestCase

  * Sometimes the order matters sometimes it doesn't

  * TextIndexNG3 is a brilliant product with excellent features but a
    large heap of external connections that are hard to debug

  * Five & ZCML is very hard to debug since there's bucket loads full of
    "magic" or whatever you want to call it that makes it damn hard
    to put in conventional print and raise statements to look through
    tracebacks.

  * Don't give up


PS. I've never touched or written an ZCML files in this environment.


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list