使用plone.app.testing 出现导入错误
我目前正在使用 4.1.2 的统一安装程序进行 Professional Plone 4 开发。我不确定在书中的显式构建过程中使用安装程序是否会导致问题,但我在将示例与已安装内容的实际情况联系起来时遇到了很多麻烦。现在,我在为我正在创建的策略包运行测试时遇到问题。
在包的 setup.py 中,我有:
extras_require={
'test': ['plone.app.testing',]
},
在 develop.cfg 中:
[buildout]
parts +=
test
[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
最后,testing.py 导入:
from plone.app.testing import (
PloneSandboxLayer,
applyProfile,
PLONE_FIXTURE,
IntegrationTesting,
)
使用开发运行构建后配置后,测试运行器将按预期安装到 bin/test 中。但是尝试运行该包的测试给了我以下结果:
$ 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
我需要做什么才能使用 plone.app.testing?
如果问题是由于使用 zope.testing.testrunner 而不是 zope.testrunner 造成的,那么具体是在哪里指定的?我在任何构建配置中都找不到对它的引用。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 extra_requires 键在测试节中指定您的鸡蛋,如下所示:
更多信息:
You have to specify your egg in the test stanza with the extra_requires key, like this:
More info: