pytest-mock
Thin wrapper around unittest.mock providing a mocker fixture for pytest, making it easier to patch objects and configure mocks in tests.
Our Verdict
A small quality-of-life upgrade over unittest.mock that is nearly universal in modern pytest test suites.
Pros
- Cleaner mocker fixture vs unittest.mock context managers
- Automatic teardown between tests
- Thin, predictable wrapper
- Familiar to anyone who knows unittest.mock
Cons
- Nothing you cannot do with unittest.mock directly
- Encourages over-mocking in some teams
- Adds one more dependency to manage
Best for: pytest users who want mock teardown handled automatically per test
Not for: Teams preferring dependency injection over patch-based mocking
When to Use pytest-mock
Good fit if you need
- mocker fixture for cleaner patch management in pytest
- Auto-reset mocks after each test without manual teardown
- Spy on real functions while tracking call history
- Combine with pytest fixtures for complex mock scenarios
Lock-in Assessment
Low 5/5
Lock-in Score 5/5
Pricing
Price wrong?pytest-mock Pricing
- Pricing Model
- free
- Free Tier
- Yes
- Entry Price
- —
- Enterprise Available
- No
- Transparency Score
- —
Beta — estimates may differ from actual pricing
1,000
1001K10K100K1M
Estimated Monthly Cost
$25
Estimated Annual Cost
$300
Estimates are approximate and may not reflect current pricing. Always check the official pricing page.
Project Health
C
Health Score
2.0k 155
Bus Factor
4
Last Commit
today
Release Freq
136d
Open Issues
14
Issue Response
N/A
License
MIT
Last checked: 2026-04-21
Community Discussion
Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.