Unit testing ImportError:没有名为PloneTestCase的模块

Unit testing ImportError:没有名为PloneTestCase的模块,unit-testing,plone,Unit Testing,Plone,基于此,我在plone 5中运行了单元测试。但是,当我执行此命令时: bin/test 我收到以下导入错误: Test-module import failures: Module: nti.content.tests Traceback (most recent call last): File "/Users/ega/CMS/PloneCourseContentCMF/PloneCourseContentCMF-Buildout/sources/nti.conten

基于此,我在plone 5中运行了单元测试。但是,当我执行此命令时:

bin/test
我收到以下导入错误:

Test-module import failures:

Module: nti.content.tests

    Traceback (most recent call last):
      File "/Users/ega/CMS/PloneCourseContentCMF/PloneCourseContentCMF-Buildout/sources/nti.content/nti/content/tests.py", line 8, in <module>
        from Products.PloneTestCase import PloneTestCase as ptc
    ImportError: No module named PloneTestCase

    Test-modules with import problems:
      nti.content.tests
    Total: 0 tests, 0 failures, 0 errors in 0.000 seconds.
测试模块导入失败:
模块:nti.content.tests
回溯(最近一次呼叫最后一次):
文件“/Users/ega/CMS/PloneCourseContentCMF/PloneCourseContentCMF Buildout/sources/nti.content/nti/content/tests.py”,第8行,在
从Products.PloneTestCase导入PloneTestCase作为ptc
ImportError:没有名为PloneTestCase的模块
有导入问题的测试模块:
nti.content.tests
总计:0次测试,0次失败,0次错误,时间为0.000秒。
我如何解决这个问题

plonet依赖于PloneTestCase

因此,您应该在setup.py上的[test]附加组件上执行相同的操作,并将PloneTestCase移植到或添加到其中,即

setup(
    ...
    extras_require=dict(
        test=[
            'Products.PloneTestCase',
        ]
    ),
)

我尝试按照您上面的建议添加PloneTestCase,但是在运行buildout之后,我仍然得到相同的错误。请确保您在buildout.cfg中添加[test],以实际加载您定义的额外测试。太好了!在setup.py和buildout.cfg中添加额外的_require可解决此导入错误。谢谢,请提供完整的错误跟踪。认识到Plone 5在beta 1中是很重要的。或者,您可能正在使用核心签出。像这样的问题最好在开发列表中提出,因为这些答案不太可能有任何长期价值,而且不太适合stackoverflow。@tisto我刚刚编辑了上面的问题。@SteveM将采纳你的建议。目前,我正在创建一个工具,将内容(包括用tinymce编写的内容)导出到latex,并需要为该工具创建单元测试。