I’m currently working through Professional Plone 4 Development while using the unified installer for 4.1.2. I’m not sure if using the installer over the explicit buildout process in the book is causing issues but I’m having a lot of trouble tying up the examples with the actuality of what is installed. Right now, I’m having an issue with running tests for the policy package I’m creating.
In the package’s setup.py, I have:
extras_require={
'test': ['plone.app.testing',]
},
In develop.cfg:
[buildout]
parts +=
test
[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
And finally, testing.py imports:
from plone.app.testing import (
PloneSandboxLayer,
applyProfile,
PLONE_FIXTURE,
IntegrationTesting,
)
After running buildout using the develop configuration, the test runner is installed as expected to bin/test. But trying to run the tests for that package gives me the following:
$ bin/test -s ctcc.policy
bin/test:239: DeprecationWarning: zope.testing.testrunner is deprecated in favour of zope.testrunner.
/opt/plone41/buildout-cache/eggs/zope.testing-3.9.6-py2.6.egg/zope/testing/testrunner/formatter.py:28: DeprecationWarning: zope.testing.exceptions is deprecated in favour of zope.testrunner.exceptions
from zope.testing.exceptions import DocTestFailureException
Test-module import failures:
Module: ctcc.policy.tests
Traceback (most recent call last):
File "/opt/plone41/zeocluster/src/ctcc.policy/ctcc/policy/tests.py", line 2, in <module>
from ctcc.policy.testing import CTCC_POLICY_INTEGRATION_TESTING
File "/opt/plone41/zeocluster/src/ctcc.policy/ctcc/policy/testing.py", line 1, in <module>
from plone.app.testing import (
ImportError: No module named testing
What do I need to do to be able to use plone.app.testing?
If the issue is due to it using zope.testing.testrunner over zope.testrunner, where exactly is this specified? I can’t find a reference to it in any of the buildout configs.
Thanks.
You have to specify your egg in the test stanza with the extra_requires key, like this:
More info: