ImportError:没有名为PloneTestCase的模块

时间:2015-04-15 20:27:31

标签: unit-testing plone

我根据此documentation在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.

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:8)

Plone recently removed依赖于PloneTestCase。

所以你应该做同样的事情并移植到plone.app.testing或者在setup.py上的[test] extras上添加PloneTestCase,即

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