[Zope] ZCatalog indexes and unit testing

Eric Bréhault ebrehault at gmail.com
Thu Jul 26 05:17:42 EDT 2007


Hello,

I have created a ZCatalog object where I declare the following index:
self.addIndex('featureType','FieldIndex')

which works fine in my application

But when I run it in my unit tests, I get the following error:
        self.addIndex('featureType','FieldIndex')
      File "/opt/Plone3/lib/python/Products/ZCatalog/ZCatalog.py", line 971,
in
addIndex
        raise ValueError, "Index of type %s not found" % type
    ValueError: Index of type FieldIndex not found

I am using the unitest package, I have declare a lot of stuff in
configurationSetUp, but something is probably missing:
(is there something to import from PluginIndexes ?)

import unittest

from zope.component.testing import setUp, tearDown
from zope.configuration.xmlconfig import XMLConfig
from zope.testing import doctest
from zope.testing.doctestunit import DocFileSuite


def configurationSetUp(self):
    setUp()
    import Products.zgeo
    import zope.component
    import zope.annotation
    import zope.app.publisher.browser
    import Products.Five
    import Products.Archetypes
    import Products.CMFCore
    import Products.GenericSetup
    XMLConfig('meta.zcml', zope.component)()
    XMLConfig('meta.zcml', zope.app.publisher.browser)()
    XMLConfig('meta.zcml', Products.Five)()
    XMLConfig('meta.zcml', Products.GenericSetup)()
    XMLConfig('meta.zcml', Products.CMFCore)()
    XMLConfig('configure.zcml', zope.annotation)()
    XMLConfig('configure.zcml', Products.Five)()
    XMLConfig('configure.zcml', Products.GenericSetup)()
    XMLConfig('configure.zcml', Products.Archetypes)()
    XMLConfig('configure.zcml', Products.zgeo)()

Thanks,

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070726/f51d8831/attachment.htm


More information about the Zope mailing list