[Zope] Writing a testcase for a Plone 2.5 product - ztc.installPackage isn't available
Israel Saeta Pérez
dukebody at gmail.com
Sat Aug 23 12:57:17 EDT 2008
I've posted this message to the plone-users list, but since nobody has
answered and I think it's really related to Zope, I'm reposting the
message here. My apologies if you receive this message twice.
Hello list,
I'm trying to write some automated test for an *eggified* content-type
product I'm developing for Plone 2.5.
My question is:
Is possible to install eggified products in zope-2.9.8 using ZopeTestCase?
And now the context:
Following the PPD book, I've put the following into the tests/base.py file:
***
# base.py
from zassh.eventoDeportivo.config import PROJECTNAME
from Testing import ZopeTestCase
from Products.Five import zcml, fiveconfigure
from Products.PloneTestCase.layer import onsetup
@onsetup
def setup_eventoDeportivo():
fiveconfigure.debug_mode = True
import zassh.eventoDeportivo
zcml.load_config('configure.zcml', zassh.eventoDeportivo)
fiveconfigure.debug_mode = False
# Let Zope know about the product we require above-and-beyond a basic
# Plone install (PloneTestCase takes care of these).
ZopeTestCase.installProduct(PROJECTNAME) # PROJECTNAME =
"zassh.eventoDeportivo"
# Import PloneTestCase - this registers more products with Zope as a side effect
from Products.PloneTestCase.PloneTestCase import PloneTestCase
from Products.PloneTestCase.PloneTestCase import setupPloneSite
# Set up a Plone site
setup_eventoDeportivo()
setupPloneSite(products=[PROJECTNAME,])
class eventoDeportivoTestCase(PloneTestCase):
"""Base class for integration tests for the 'eventoDerpotivo'
product. This may
provide specific set-up and tear-down operations, or provide convenience
methods.
"""
***
But when running the tests from a buildout, ZopeTestCase can't install
the zassh.eventoDeportivo product:
dukebody at schrodinger trunk $ bin/instance test -s zassh.eventoDeportivo
Running tests at level 1
Installing CMFCore ... done (0.013s)
[...]
Installing kupu ... done (0.031s)
Running Products.PloneTestCase.layer.PloneSite tests:
Set up Products.PloneTestCase.layer.ZCML in 1.958 seconds.
Installing zassh.eventoDeportivo ... NOT FOUND
and obviously all my tests fail.
PPD uses ztc.installPackage instead of ztc.installProduct, but the
installPackage method isn't availabe in Zope-2.9.8-final, which I'm
using with Plone-2.5.3. [1]
My question was:
Is possible to install eggified products in zope-2.9.8 using
ZopeTestCase? If so, what's wrong in my base.py file?
Thanks in advance.
[1] http://www.archivum.info/zope-checkins@zope.org/2007-06/msg00100.html
--
Israel Saeta Pérez
http://dukebody.com
More information about the Zope
mailing list