mock breaking changes
mock 5.0.0 (December 28, 2022) is its newest release with breaking changes, 11 of them. The first: Removed __div__. Every breaking API change we have recorded in mock on PyPI: 11 breaking changes in 1 version. Below, its one version with breaking changes, newest first, removals and renames first, each with its source.
Updated December 4, 2026
On this page
Latest version 5.2.0, released March 3, 2025.
Packages on PyPI run on Python. Python end of life dates.
mock 5.0.0 breaking changes
- Removed
__div__
The __div__ special method is no longer supported by unittest.mock because Python 3 does not use it. github.com - Behavior changed
inspect.iscoroutinefunction
Code that checks inspect.iscoroutinefunction on an AsyncMock will now see True, which may change branch logic in tests. github.com - Behavior changed
mock.Mock
An already-mocked object can no longer be passed to mock.Mock() as a spec. Pass a real spec object instead. github.com - Behavior changed
unittest.mock.create_autospec
An already-mocked object can no longer have an attribute mocked with autospec=True or be passed to create_autospec. Use a real spec object instead. github.com - Behavior changed
unittest.mock.patch
Invalid arguments to patch now raise TypeError with a clear message. Code that catches AttributeError from patch must be updated. github.com - Signature changed
mock.create_autospec
Was def create_autospec(spec, spec_set=False, instance=False, _parent=None, _name=None, **kwargs); now def create_autospec(spec, spec_set=False, instance=False, _parent=None, _name=None, *, unsafe=False, **kwargs). pypi.org - Signature changed
mock.mock.create_autospec
Was def create_autospec(spec, spec_set=False, instance=False, _parent=None, _name=None, **kwargs); now def create_autospec(spec, spec_set=False, instance=False, _parent=None, _name=None, *, unsafe=False, **kwargs). pypi.org - Signature changed
mock.mock.NonCallableMock.__new__
Was def __new__(cls, *args, **kw); now def __new__(cls, spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs). pypi.org - Signature changed
mock.mock.patch
Was def patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs); now def patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *... pypi.org - Signature changed
mock.NonCallableMock.__new__
Was def __new__(cls, *args, **kw); now def __new__(cls, spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs). pypi.org - Signature changed
mock.patch
Was def patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs); now def patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *... pypi.org
Check your code
These are the changes. To see which of them reach your code, scan a public repository, or have your coding agent call check_code with your manifest or lockfile over MCP. The API reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

Put your code on continuous maintenance.
Scan a public repository now, or give your agent one line.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.