unit-testing - 导入错误 : No module named PloneTestCase

标签 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.

我该如何解决这个问题?

最佳答案

Plone recently removed它对 PloneTestCase 的依赖。

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

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

关于unit-testing - 导入错误 : No module named PloneTestCase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29660234/

相关文章:

javascript - $q.when 中的 httpBackend Mock AJAX ES6 Promise

python - 为返回对象层次结构的函数编写单元测试

postgresql - 在 Plone 站点上调整 PostgreSQL 的 RelStorage 和参数

xslt - 如何将 Diazo 主题参数插入到某些主题的类属性中?

c# - 如何模拟FeatureFilterEvaluationContext参数?

c# - Entity Framework Core 唯一索引测试

plone - 如何让 instance-Z2.log 注册实际的用户名?

css - Diazo 规则拆分列中的内容

包装它时的python模拟属性 setter

plone - Plone 4 中的 AJAX'y 图像弹出窗口