--- id: mock version: "5.2.0" license: unclear license_treatment: permissive maintenance: aging --- # mock — Rolling backport of unittest.mock for all Pythons License: permissive · Maintenance: aging · Popularity: top 1,000 on PyPI ## Install pip install mock uv add mock poetry add mock ## Description mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. mock is now part of the Python standard library, available as `unittest.mock `_ in Python 3.3 onwards. This package contains a rolling backport of the standard library mock code compatible with Python 3.6 and up. Please see the standard library documentation for more details. :Homepage: `Mock Homepage`_ :Download: `Mock on PyPI`_ :Documentation: `Python Docs`_ :License: `BSD License`_ :Support: `Mailing list (testing-in-python@lists.idyll.org) `_ :Code: `GitHub `_ :Issue tracker: `GitHub Issues `_ :Build status: |CircleCI|_ |Docs|_ .. |CircleCI| image:: https://circleci.com/gh/testing-cabal/mock/tree/master.svg?style=shield .. _CircleCI: https://circleci.com/gh/testing-cabal/mock/tree/master .. |Docs| image:: https://readthedocs.org/projects/mock/badge/?version=latest .. _Docs:... ## AI interpretation — verify before relying mock provides a backport of Python's standard library unittest.mock for Python 3.6+, allowing you to replace parts of your system under test with mock objects and assert how they were used. Verdict: mock is a stable, zero-dependency backport of unittest.mock suitable for testing on Python 3.6+. Its aging maintenance status (last release 528 days ago) is mitigated by the fact that it tracks a stable standard library API and has no known vulnerabilities. Use it if you need compatibility with older Python versions; otherwise, prefer the built-in unittest.mock. [View on SkillFed](https://skillfed.io/packages/mock) · [View on PyPI](https://pypi.org/project/mock/)