pytest-dev/pytest-mock
Thin-wrapper around the mock package for easier use with pytest observed · 2026-08-28
Health v2 · maintenance only
77/100
- Activity 99
- Release rhythm 36
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 56.0
- age_days: 4431
- days_rel: 351
- days_push: 8
- n_releases_24m: 3
Adoption not part of the score
2039 stars · 168 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A pytest plugin that provides a `mocker` fixture wrapping the mock package's patching API. It automatically undoes mocks after each test and adds utilities like spy and stub with pytest-style introspection.
Use cases
- mock functions in pytest tests
- patch os.remove in a unit test
- spy on method calls during testing
- create stubs for pytest test cases
- automatically undo patches after each test
- replace unittest.mock boilerplate in pytest
When to choose
- you write tests with pytest and need mocking
- you want automatic patch cleanup between tests
- you prefer a fixture-based API over context managers and decorators
When to avoid
- you don't use pytest as your test runner
- you need mocking features outside of pytest
- you already prefer raw unittest.mock with no wrapper
Facets
plugin · maturity stable
mocking testing testing developer-tools python cli pytest-plugin pytest-fixture test-doubles spy stub
2 sources
- readme: https://github.com/pytest-dev/pytest-mock · fetched 2026-08-28 · 9548e72b99d2
- registry_pypi: https://pypi.org/pypi/pytest-mock/json · fetched 2026-08-29 · 0b8ac2b01ec6
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| pytest-dev/pytest-mock | main | 77 |
For agents
markdown · JSON · MCP: product_card(name="pytest-dev/pytest-mock")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem