# What changed in pytest-mock

> 20 changes in pytest-mock 3 from its official release notes, upgrade guides and advisories: 2 breaking, 1 new APIs and options. Each one cited. Sources checked 2026-10-18. HTML: https://unstale.sh/pypi/pytest-mock/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## pytest-mock 3

### Breaking changes

- Handling for this RuntimeError was removed because it can no longer occur in supported Python versions. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
- Support for Python 3.9 was dropped because it is EOL. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)

### New APIs and options

- Added SpyType for annotating mocker.spy results. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)

### Fixes and other changes

- Failures no longer show pytest introspection comparing expected and actual calls position by position; the mock's own message listing both is retained. (3.17.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.17.0)
- Failures no longer show pytest introspection comparing expected and actual calls position by position; the mock's own message listing both is retained. (3.17.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.17.0)
- Mock assertion failures are reported only once, without chaining the original mock-module error before them. (3.17.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.17.0)
- Assertion failures no longer show misleading introspection for assertions unrelated to the last call's arguments; autospecced positional and keyword arguments are treated alike, and empty sections are omitted when rewriting is unavailable. (3.17.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.17.0)
- Failure introspection is no longer misleading, and passing calls by keyword no longer raises IndexError instead of AssertionError. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- Expected calls supplied as plain tuples no longer cause ValueError or misleading introspection. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- resetall no longer skips mocks patched with patch.multiple, whether created by it or passed explicitly. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- Resetting a spy's side_effect resumes calling the spied code and clears any side_effect set on the spy. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- resetall also resets spies' spy_return and spy_exception, and no longer overwrites those attributes on non-spy mocks. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- Stopping a mock no longer sometimes stops the wrong mock, including mocks from create_autospec. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- When the same object is used in several patches, stop undoes the most recent patch first. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- The value is cleared after a spied synchronous or asynchronous function raises, matching spy_return. (3.16.1) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.1)
- Async mock assertion introspection now uses awaited arguments instead of the latest call's arguments. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
- return_value=True now applies to non-callable mocks, including those returned by create_autospec. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
- side_effect=True now applies to non-callable mocks, including those returned by create_autospec. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
- Fixed duplicate_iterators=True for async functions spied with mocker.spy. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
- Added support for Python 3.15. (3.16.0) — [release notes](https://github.com/pytest-dev/pytest-mock/releases/tag/v3.16.0)
