Mockify
Highly customizable and expressive mocking library for Python.
About
Mockify is a library inspired by Google Mock C++ framework, but adopted to Python world.
Mockify is based on expectations that you need to record on your mocks before those are called by code you're testing. And expectations you're recording are basically assertions that must pass before test ends. Along with expectations you can also record actions the mock will execute once called. And all of these is provided by simple, expressive and easy to use API.
Here's a simple example:
from mockify.core import satisfied
from mockify.mock import Mock
from mockify.actions import Return
def func_caller(func):
return func()
def test_func_caller():
func_mock = Mock('greet')
func_mock.expect_call().will_once(Return('Hello, world!'))
with satisfied(func_mock):
assert func_caller(func_mock) == 'Hello, world!'
Mockify allows you to:
- Record expectations with any number of positional and/or keyword arguments,
- Set expected call count or call count range,
- Record action chains, allowing subsequent action can be performed on subsequent call to same mock,
- Record repeated actions that can be executed any number of times,
- Use matchers, allowing to match range of parameters the mock is called with instead of exact ones,
- and more.
I hope you'll find this library useful.
Documentation
Newest documentation can be found at https://mockify.readthedocs.org/.
Source
Source code is available at https://github.com/mwiatrzyk/mockify.
License
This software is released under the terms of the MIT license.
Metadata
Release files for mockify 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mockify-0.14.0.tar.gz | 34.7 kB | Without provenance | Details for mockify-0.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mockify-0.14.0-py3-none-any.whl | Python 3 | none | any | Details for mockify-0.14.0-py3-none-any.whl |
Total release size: 82.9 kB
Release files / mockify-0.14.0.tar.gz
| Download URL | mockify-0.14.0.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb29101062bac981aebd0e571e37a1fac7e0796be47fe50e3a93fc879f90011d
|
|
BLAKE2b-256 checksum How to use checksums |
e2b5e1ed8644c788191be497187691b72d2c5c28885a6bb67e0d560a59c36243
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/5.15.0-1057-aws
|
Release files / mockify-0.14.0-py3-none-any.whl
| Download URL | mockify-0.14.0-py3-none-any.whl |
|---|---|
| Size | 48.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e112bd9b58cf64d17448d63ce144f06ba8ccbce9a0ede35b0dc7d0c24f6cddaf
|
|
BLAKE2b-256 checksum How to use checksums |
b3d9b499945b1949bdce6ae0bec30be05cba1bbfbff9a85b37ce423eebc71a90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/5.15.0-1057-aws
|
Security for mockify 0.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.