There are already several Python mocking libraries available, so why another one?
Most mocking libraries follow the ‘record -> replay’ pattern of mocking. I prefer the ‘action -> assertion’ pattern, which is more readable and intuitive particularly when working with the Python unittest module. For a discussion of the merits of the two approaches, see Mocking, Patching, Stubbing: all that Stuff.
mock provides a core Mock class that is intended to reduce the need to create a host of trivial stubs throughout your test suite. After performing an action, you can make assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set specific attributes in the normal way.
It also provides a patch decorator that handles patching module and class level attributes within the scope of a test, along with sentinel for creating unique objects.
Metadata
Release files for mock 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mock-0.4.0-py2.6.egg | Legacy Egg format | - | - | Details for mock-0.4.0-py2.6.egg |
| mock-0.4.0-py2.5.egg | Legacy Egg format | - | - | Details for mock-0.4.0-py2.5.egg |
| mock-0.4.0-py2.4.egg | Legacy Egg format | - | - | Details for mock-0.4.0-py2.4.egg |
Total release size: 16.9 kB
Release files / mock-0.4.0-py2.6.egg
| Download URL | mock-0.4.0-py2.6.egg |
|---|---|
| Size | 5.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
136d86d121fef17549bc55b24b8e6f5335e2d152ee7dea58c20535292db0f262
|
|
BLAKE2b-256 checksum How to use checksums |
0b6a5e3ead38ff3f10031f16f3c834037a1f6c454f54a63b54b56843cd98a7cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mock-0.4.0-py2.5.egg
| Download URL | mock-0.4.0-py2.5.egg |
|---|---|
| Size | 5.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
232f8b4e1df369848e235c4fda85bba41e95b75be40674fea060c4fdee7ab04c
|
|
BLAKE2b-256 checksum How to use checksums |
d3ce3691e7e85b1d48178d2379227fbfe448a788a816ee8e883f71a5526ba1e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mock-0.4.0-py2.4.egg
| Download URL | mock-0.4.0-py2.4.egg |
|---|---|
| Size | 5.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
cde44a12fb139ea1da4fe7a2d7d876a63a1e663444bc0a670f5ef5617c2fd6c2
|
|
BLAKE2b-256 checksum How to use checksums |
337f031bd64d3acbf5447c107f55f592619eccdef6b30e87570592d413d6c9cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mock 0.4.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.