skillfed

mock

Rolling backport of unittest.mock for all Pythons

mock Permissive license AGING 538 v5.2.0 released

Install

mock on PyPI

pip

pip install mock

uv

uv add mock

poetry

poetry add mock

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 528 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: mock-5.2.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

About mock

from the package's own PyPI description — quoted content, verbatim

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 <https://docs.python.org/dev/library/unittest.mock.html>_ 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) <http://lists.idyll.org/listinfo/testing-in-python> :Code: GitHub <https://github.com/testing-cabal/mock> :Issue tracker: GitHub Issues <https://github.com/testing-cabal/mock/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:...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

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.

Low friction: pure Python wheel with zero runtime dependencies. Maintenance is aging (528 days since last release), but the repository remains active with a recent commit on 2025-03-03 and the package is marked Production/Stable.

BSD License (permissive) means you can use this freely in commercial and open-source projects with minimal restrictions, only requiring license attribution.

Usage

pip install mock

from mock import Mock, patch

m = Mock()
m.method()
assert m.method.called

Requires Python 3.6 or later; for Python 3.3+, consider using the built-in unittest.mock from the standard library instead.

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.

Needs verification

  • Whether the 528-day release gap reflects intentional stability or reduced active maintenance.
  • Whether there are known compatibility issues with Python 3.13 despite the classifier listing.
mock objects for testingunittest mock backportreplace test dependenciesassert mock callspython testing librarystub and spy functionstest doubles

Similar packages