ImportError: No module named PloneTestCase

ImportError: No module named PloneTestCase

我 运行 基于此 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.

我该如何解决这个问题?

Plone recently removed 它对 PloneTestCase 的依赖。

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

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