Skip to main content

An easy-to-use but full featured mocking library for Python.

Project description

Mocki aims to be an easy-to-use but full featured mocking library for Python.

Installation

Here is how to install Mocki using pip :

pip install Mocki

Starting with Mocki

Here is how to instantiate a new mock with Mocki :

>>> import mocki.core
>>>
>>> mock = mocki.core.Mock('myMock')

There are basically two things we can do with this mock :

  • stub it to do a particular action on a particular call :

>>> mock.on_call('myCall').do_return('myValue')
>>>
>>> mock('myCall')
'myValue'
  • verify whether or not a particular call was invoked on it :

>>> mock.verify_call('myCall').invoked_once()
>>>
>>> mock.verify_call('myCall').invoked_exactly(2)
Traceback (most recent call last):
...
AssertionError: Found one matching call invoked from myMock :
> myMock('myCall')

Documentation

See the online documentation for more information on how to use Mocki.

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

Mocki-1.7.7.tar.gz (23.8 kB view details)

Uploaded Source

File details

Details for the file Mocki-1.7.7.tar.gz.

File metadata

  • Download URL: Mocki-1.7.7.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Mocki-1.7.7.tar.gz
Algorithm Hash digest
SHA256 66e7c0f852fa45698b24a4e3948a1710870ac27ca79e9b82912f33efe98d72fc
MD5 fc2e9744a597bb22e33249e7c1529113
BLAKE2b-256 3bdd96631bd3dd18665de158b758935e28afec79feb0918dff54d140e7d858ff

See more details on using hashes here.

Supported by

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