Plonistas, I have no idea why nobody uses this, but if you have a simple add-on with tests, in 90% of the cases your testing.py
can be based on the PloneWithPackageLayer
like so:
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE
from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PloneWithPackageLayer
from plone.testing import zope
import my.package
MY_PACKAGE_FIXTURE = PloneWithPackageLayer(
bases=(PLONE_APP_CONTENTTYPES_FIXTURE,),
name="MyPackageLayer:Fixture",
gs_profile_id="my.package:default",
zcml_package=my.package,
zcml_filename="configure.zcml",
additional_z2_products=["my.package"],
)
MY_PACKAGE_INTEGRATION_TESTING = IntegrationTesting(
bases=(MY_PACKAGE_FIXTURE,),
name="MyPackageLayer:IntegrationTesting",
)
MY_PACKAGE_FUNCTIONAL_TESTING = FunctionalTesting(
bases=(MY_PACKAGE_FIXTURE,),
name="MyPackageLayer:FunctionalTesting",
)
MY_PACKAGE_ACCEPTANCE_TESTING = FunctionalTesting(
bases=(
MY_PACKAGE_FIXTURE,
REMOTE_LIBRARY_BUNDLE_FIXTURE,
zope.WSGI_SERVER_FIXTURE,
),
name="MyPackageLayer:AcceptanceTesting",
)
In my opinion this simplifies things a lot.