Skip to main content

Mocking library focusing on very explicit definition of the mocks' behaviour

Project description

DO NOT USE THIS LIBRARY: there is now a standard mocking library in Python. I will not fix anything in this library and I’m migrating my own projects to unittest.mock.

MockMockMock is a Python (2.7+ and 3.3+) mocking library focusing on very explicit definition of the mocks’ behaviour. It allows as-specific-as-needed unit-tests as well as more generic ones.

It’s licensed under the MIT license. It’s available on the Python package index, its documentation is hosted by Python and its source code is on GitHub.

https://img.shields.io/travis/jacquev6/MockMockMock/master.svg https://img.shields.io/coveralls/jacquev6/MockMockMock/master.svg https://img.shields.io/codeclimate/github/jacquev6/MockMockMock.svg https://img.shields.io/scrutinizer/g/jacquev6/MockMockMock.svg https://img.shields.io/pypi/dm/MockMockMock.svg https://img.shields.io/pypi/l/MockMockMock.svg https://img.shields.io/pypi/v/MockMockMock.svg https://img.shields.io/pypi/pyversions/MockMockMock.svg https://img.shields.io/pypi/status/MockMockMock.svg https://img.shields.io/github/issues/jacquev6/MockMockMock.svg https://badge.waffle.io/jacquev6/MockMockMock.png?label=ready&title=ready https://img.shields.io/github/forks/jacquev6/MockMockMock.svg https://img.shields.io/github/stars/jacquev6/MockMockMock.svg

Quick start

Install from PyPI:

$ pip install MockMockMock

Import:

>>> from MockMockMock import *

Write some code to test:

>>> def f(source):
...   return source.get(42) * 2

Mock:

>>> mocks = Engine()
>>> mock = mocks.create("mocks")

Expect:

>>> mock.expect.get(42).and_return(12)

Test:

>>> assert f(mock.object) == 24

Verify all expected calls have been done:

>>> mocks.tearDown()

Project details


Download files

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

Files for MockMockMock, version 0.5.3
Filename, size File type Python version Upload date Hashes
Filename, size MockMockMock-0.5.3.tar.gz (11.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page