testfixtures
A collection of helpers and mock objects for unit tests and doc tests.
Decision gist · record as of 2026-08-14
Yes. Testfixtures is a stable, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It solves multiple common testing problems with a cohesive API and is widely used (top 5000 PyPI packages). Install it if your test suite needs readable comparisons, object mocking, datetime control, or subprocess/logging verification.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Low install friction with a single lightweight runtime dependency (typing-extensions).
- The package is actively maintained with a recent release 37 days ago and has been in production use since 2008.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
last release 2026-07-08 (37 days) · last repo commit 2026-08-12 · 244 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,405,022 downloads/mo, #2,632 on PyPI
Alternatives
Verify before relying
pip install testfixtures
from testfixtures import compare
compare(actual_value, expected_value)- Whether pandas, polars, numpy, and pydantic support mentioned in the description requires those packages as optional dependencies or if they are tested only when present.
- Whether loguru and structlog integration requires those packages as optional dependencies or if LogCapture works without them.
What it is and what it does
Testfixtures is a mature testing utility library that bundles helpers and mock objects to simplify common testing scenarios in Python. It provides tools for asserting equality with readable diffs on nested structures, replacing objects and methods during tests, mocking datetime/time APIs, testing subprocesses and command-line scripts, capturing logs and stream output, working with temporary files and directories, and checking exceptions and warnings.
The package is designed to integrate into your test suite with minimal setup—you import the specific helpers you need and use them directly in your tests. It has no heavy dependencies beyond typing-extensions and requires Python 3.11 or later. The library covers both general testing needs and specialized scenarios like Django model comparison and Twisted logging assertions.
Use it for
- Assert equality on complex nested data structures with clear, readable diffs when tests fail.
- Swap out methods or objects during a test and verify they were called correctly without manual restoration.
- Test code that depends on the current date or time by mocking datetime and time APIs to a fixed point.
- Capture and verify log messages from your code, including from loguru and structlog libraries.
- Test subprocess-based code by mocking Popen without spawning real processes.
- Verify command-line scripts work correctly end-to-end, checking output, logging, and return codes.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Testfixtures is a stable, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It solves multiple common testing problems with a cohesive API and is widely used (top 5000 PyPI packages). Install it if your test suite needs readable comparisons, object mocking, datetime control, or subprocess/logging verification.
Install
testfixtures on PyPI
Before you install
Low install friction with a single lightweight runtime dependency (typing-extensions). The package is actively maintained with a recent release 37 days ago and has been in production use since 2008.
Requires Python 3.11 or later.
License in practice
MIT license is permissive, allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install testfixtures
from testfixtures import compare
compare(actual_value, expected_value)
Verify before relying
- Whether pandas, polars, numpy, and pydantic support mentioned in the description requires those packages as optional dependencies or if they are tested only when present.
- Whether loguru and structlog integration requires those packages as optional dependencies or if LogCapture works without them.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,405,022 / month, #2,632 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 |
Evidence: testfixtures-12.3.0-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 › “compare and assert equality”
- testfixturesTestfixtures provides helpers and mock objects for writing unit and…
- pytest-unorderedProvides a pytest assertion helper to compare collections by content…
- pyspark-testProvides a testing utility to assert equality between two PySpark…
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 testpath · callee · time-machine · dirty-equals · testtools · mock-open · pytest-mock · flexmock · pytest-subprocess · scripttest