types-mock
Typing stubs for mock
Decision gist · record as of 2026-08-14
Yes, if you use mock in typed test code and want your type checker to validate test setup. It has no runtime dependencies, low friction, and is actively maintained. If you don't use a type checker or don't test with mock, it adds no value.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained as part of typeshed; last release 88 days ago.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows use in most projects without restriction.
last release 2026-05-18 (88 days) · last repo commit 2026-08-14 · 37 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,331,311 downloads/mo, #2,117 on PyPI
Alternatives
Verify before relying
pip install types-mock
# Then use mock in your code; type checkers will now understand it
import mock
with mock.patch('module.function'):
pass- Whether this package is required for type checking mock, or if mock itself now includes inline types in recent versions.
What it is and what it does
types-mock is a type stub package that bridges the gap between the mock library and static type checkers. It provides type annotations for mock's public API, allowing mypy, pyright, and other type checkers to understand and validate code that uses mock for unit testing. The stubs are generated from typeshed, a community-maintained repository of type information for Python packages.
This package is useful when you want type safety in test code. Without it, type checkers see mock as untyped, which can hide bugs in test setup or assertions. The stubs are kept in sync with mock==5.2.* releases and have been validated against mypy 2.1.0 and pyright 1.1.409.
Use it for
- Enable type checking in test files that use mock.patch, mock.Mock, and other mock utilities.
- Catch typos or incorrect mock configuration before runtime in CI/CD pipelines.
- Provide IDE autocomplete and inline documentation for mock's API in test code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use mock in typed test code and want your type checker to validate test setup.
It has no runtime dependencies, low friction, and is actively maintained. If you don't use a type checker or don't test with mock, it adds no value.
Install
types-mock on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as part of typeshed; last release 88 days ago.
Requires Python 3.10 or later.
License in practice
Apache-2.0 permissive license allows use in most projects without restriction.
Quickstart
pip install types-mock
# Then use mock in your code; type checkers will now understand it
import mock
with mock.patch('module.function'):
pass
Verify before relying
- Whether this package is required for type checking mock, or if mock itself now includes inline types in recent versions.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 88 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,331,311 / month, #2,117 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Typing :: Stubs Only |
Evidence: types_mock-5.2.0.20260518-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “type stubs for mock”
- types-mockProvides type stubs for the mock library, enabling type checkers like…
- pytest-stubA pytest plugin that replaces package, module, and attribute…
- flexmockflexmock creates mock, stub, spy, and fake objects for testing Python…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also mock · types-assertpy · types-channels · types-PySocks · types-psutil · types-pexpect · types-greenlet · types-passlib · types-WTForms · types-aws-xray-sdk