-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Bréhault wrote:
> 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)()

You need to get the 'PluginIndexes' product initialization triggered.
Look into ZopeTestCase's 'installProduct' helper function.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGqLxU+gerLs4ltQ4RAsF7AJ9HzKOCqIVefVxtKpViXsbK/AFS7QCg15IT
Nzc/HTM4C1ksfOV/03CIwJg=
=65tV
-----END PGP SIGNATURE-----

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to