unit-testingplone

ImportError: No module named PloneTestCase


I run unit test in plone 5 based on this documentation . However when I executed this command :

bin/test

I got the following import error:

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.

How can I solve this issue?


Solution

  • Plone recently removed its dependency on PloneTestCase.

    So you should either do the same and port to plone.app.testing or add PloneTestCase on your [test] extras on setup.py, i.e.

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