---
title: "mock 5.0.0 Breaking Changes on PyPI | Since.dev"
description: "What each mock release removed, renamed or changed: 11 breaking changes in 1 version on PyPI, each with its source."
canonical_url: https://since.dev/packages/pypi/mock
last_updated: 2026-12-04
---

# 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

Latest version `5.2.0`, released March 3, 2025. 

Packages on PyPI run on Python. [Python end of life dates](https://since.dev/calendar/python.md).

## mock 5.0.0 breaking changes

mock 5.0.0, released December 28, 2022: 11 breaking changes.

- **Removed** `__div__`  

The \_\_div\_\_ special method is no longer supported by unittest.mock because Python 3 does not use it. [github.com](https://github.com/testing-cabal/mock/blob/5.0.0/CHANGELOG.rst)
- **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](https://github.com/testing-cabal/mock/blob/5.0.0/CHANGELOG.rst)
- **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](https://github.com/testing-cabal/mock/blob/5.0.0/CHANGELOG.rst)
- **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](https://github.com/testing-cabal/mock/blob/5.0.0/CHANGELOG.rst)
- **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](https://github.com/testing-cabal/mock/blob/5.0.0/CHANGELOG.rst)
- **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](https://pypi.org/project/mock/5.0.0/)
- **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](https://pypi.org/project/mock/5.0.0/)
- **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](https://pypi.org/project/mock/5.0.0/)
- **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](https://pypi.org/project/mock/5.0.0/)
- **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](https://pypi.org/project/mock/5.0.0/)
- **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](https://pypi.org/project/mock/5.0.0/)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#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.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
