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
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
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
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
Health Score
4
today
136d
14
N/A
MIT
Last checked: 2026-04-21
Lock-in Assessment
π Thinking about migrating off pytest-mock?
Get an AI-drafted migration plan + a copy-paste email to pytest-mock support requesting a data export. Pick where you're moving to and tell us your context.
Looking for alternatives to pytest-mock?
Answer 4 quick questions β get an AI-ranked shortlist of tools that match your stack and requirements.
Open AI Tool FinderCommunity Discussion
Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.