I'm facing an issue migrating our Plone site to using plone.app.testing. I'm getting the message Test-module import failures
as the first line outputted on the console.
C:\sandbox\cms.buildout>bin\test -s soschildrensvillages
Test-module import failures:
Module: soschildrensvillages.contenttypes.tests.test_portlet_concept_news
Traceback (most recent call last):
...
File "c:\sandbox\cms.buildout\src\soschildrensvillages\soschildrensvillages\contenttypes\content\concept_folder.py", line 7, in <module>
from plone.app.folder.folder import ATFolder
File "c:\sandbox\cms.buildout\eggs\plone.app.folder-1.0.5-py2.7.egg\plone\app\folder\folder.py", line 4, in <module>
from Products.ATContentTypes.interface import IATFolder
File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\__init__.py", line 32, in <module>
import Products.ATContentTypes.content
File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\content\__init__.py", line 7, in <module>
import Products.ATContentTypes.content.folder
File "c:\sandbox\cms.buildout\eggs\products.atcontenttypes-2.1.13-py2.7.egg\Products\ATContentTypes\content\folder.py", line 19, in <module>
from plone.app.folder import folder
ImportError: cannot import name folder
There are more import errors as it tries to set-up testing layers and run tests. Only the unit tests (plain TestCase) run without error.
These errors only started appearing after I migrated the last test from Products.PloneTestCase
and including the following line in our testing.py module solves the issue.
from Products.PloneTestCase import PloneTestCase as ptc
I'm not sure what level of detail someone will need to help out here but any pointers to what I could try would be most appreciated.
Our testing.py looks like
products = ('collective.lineage', 'soschildrensvillages')
class SOSChildrenLayer(PloneWithPackageLayer):
defaultBases = (PLONE_FIXTURE,)
def __init__(self):
super(SOSChildrenLayer, self).__init__(
zcml_filename='configure.zcml', zcml_package=soschildrensvillages,
additional_z2_products=products, gs_profile_id='soschildrensvillages:default'
)
def setUpZCMLFiles(self):
super(SOSChildrenLayer, self).setUpZCMLFiles()
self.loadZCML(name='overrides.zcml', package=soschildrensvillages)
def tearDownZope(self, app):
super(SOSChildrenLayer, self).tearDownZope(app)
for product in products:
z2.uninstallProduct(app, product)
SOS_CHILDREN_FIXTURE = SOSChildrenLayer()
SOS_CHILDREN_INTEGRATION_TESTING = IntegrationTesting(
bases=(SOS_CHILDREN_FIXTURE,),
name="SOSChildren:Integration"
)
In setup.py we have
install_requires=[
'setuptools',
'collective.lineage',
'plone.app.caching',
'plone.app.folder',
'plone.app.iterate',
'quintagroup.seoptimizer',
'rdflib',
'soschildrensvillages.taxonomy',
'soschildren.contentexperiments',
'Products.AdvancedQuery',
'Products.ATContentTypes',
'Products.CMFPlone',
'Products.CMFPlacefulWorkflow'
# -*- Extra requirements: -*-
],
In configure.zcml we have
<includeDependencies package="." />
concept_folder.py includes the definition of a Archetypes content type.