Skip to main content

Mock unit test case based on ``mocker``

Project description


This package contains a unittest test class based on the one from the Mocker mock library (

This class provides support for registering Zope 3 components (utilities, adapters, subscription adapters and event handlers) from mocks and tearing down the global component registry during test tear-down.

There are also a few convenience methods and parameter checkers that are useful to Zope and Plone testing.

Please see the Mocker documentation for more detail:

See for more detail on the mock helper methods.

A test case that mocks a utility may look like this:

from plone.mocktestcase import MockTestCase

from my.package.interfaces import IMyInterface
from import testable_method

class MyTestCase(MockTestCase):

    def test_something(self):

        utility_mock = self.mocker.mock()
        self.mock_utility(utility_mock, IMyInterface)

        # Put mocker into replay mode

        # Verify that testable_method() looks up a utility for
        # IMyInterface and calls do_something() on it, which returns
        # "foo".




  • Minor amendments to mock Zope 3 component support


  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plone.mocktestcase-1.0b2.tar.gz (8.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page