使用plone.app.testing导入错误

使用plone.app.testing导入错误,testing,plone,buildout,Testing,Plone,Buildout,我目前正在进行专业的Plone 4开发,同时使用4.1.2的统一安装程序。我不确定在书中明确的构建过程中使用安装程序是否会引起问题,但我很难将示例与安装的实际情况联系起来。现在,我在为正在创建的策略包运行测试时遇到问题 在软件包的setup.py中,我有: extras_require={ 'test': ['plone.app.testing',] }, 在develope.cfg中: [buildout] parts += test [test] recipe = zc.

我目前正在进行专业的Plone 4开发,同时使用4.1.2的统一安装程序。我不确定在书中明确的构建过程中使用安装程序是否会引起问题,但我很难将示例与安装的实际情况联系起来。现在,我在为正在创建的策略包运行测试时遇到问题

在软件包的setup.py中,我有:

extras_require={
    'test': ['plone.app.testing',]
},
在develope.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,
)
在使用开发配置运行buildout之后,测试运行程序按预期安装到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
$bin/test-s ctcc.policy
bin/test:239:DeprecationWarning:zope.testing.testrunner被弃用,取而代之的是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被弃用,取而代之的是zope.testrunner.exceptions
从zope.testing.exceptions导入DocTestFailureException
测试模块导入失败:
模块:ctcc.policy.tests
回溯(最近一次呼叫最后一次):
文件“/opt/plone41/zeocluster/src/ctcc.policy/ctcc/policy/tests.py”,第2行,在
从ctcc.policy.testing导入ctcc\u policy\u INTEGRATION\u testing
文件“/opt/plone41/zeocluster/src/ctcc.policy/ctcc/policy/testing.py”,第1行,在
从plone.app.testing导入(
ImportError:没有名为testing的模块
我需要做什么才能使用plone.app.testing

如果问题是由于使用zope.testing.testrunner而不是zope.testrunner造成的,那么具体在哪里指定的?我在任何构建配置中都找不到对它的引用


谢谢。

您必须在测试节中使用额外的_requires键指定您的鸡蛋,如下所示:

[test]
recipe = zc.recipe.testrunner
eggs =
    my.package [test]
defaults = ['--auto-color', '--auto-progress']
更多信息:


在我的辩护中,我确实阅读了您链接到的文档,只是没有深入了解其中提到的文档:谢谢,这帮了大忙。