Comparison
mock vs mockito vs pytest-mock
Maintenance, adoption and momentum side by side, from PyPI, GitHub and deps.dev data refreshed every day.
Rolling backport of unittest.mock for all Pythons
Low maintenance activity. Last release 21 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases. It brings a standard-library module to older Pythons: on current versions, use the built-in one.
$
pip install mockSpying framework
Maintained. Last release 8 months ago.
$
pip install mockitoThin-wrapper around the mock package for easier use with pytest
Actively maintained. Last release 6 weeks ago, commits in 20 of the last 26 weeks. A safe choice.
$
pip install pytest-mockIn short
- pytest-mock is the most used: 89.8M downloads a month, 4.4× more than mock.
- pytest-mock also has the best Pythie’s Index (77).
- Safe default for a new project: pytest-mock.
Side by side
| Metric | mock | mockito | pytest-mock |
|---|---|---|---|
| Pythie’s Index | Pythie’s Index: 29 | 67 |