pytest-regressions
Easy to use fixtures to write regression tests.
What it is and what it does
pytest-regressions is a pytest plugin that simplifies writing regression tests by automating the comparison of test output against saved baseline data. Instead of manually writing assertions for complex outputs, you save the expected result once and the fixture automatically verifies that future test runs produce identical data. It handles general data, images, files, and numeric tables through a unified interface.
The plugin integrates with pytest-datadir to manage baseline data files in a dedicated directory structure. When a test runs, the fixture compares the current output to the stored baseline; on first run or when you intentionally update baselines, it saves the new data. This approach is particularly useful for testing functions that produce complex, multi-line, or binary output where manual assertion writing would be tedious or error-prone.
Use it for:
- Verify that refactored code produces identical output to the original implementation.
- Test image generation or rendering by comparing pixel data against saved reference images.
- Validate formatted reports, logs, or structured text output remains unchanged across releases.
- Regression-test numeric computation results (tables, matrices) against known-good baselines.
- Detect unintended changes in file generation or serialization behavior.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides pytest fixtures for writing regression tests that compare current output against saved baseline data (text, images, files, numeric tables).
Yes. Low install friction, active maintenance, no known vulnerabilities, and permissive MIT license. The plugin solves a real testing problem—baseline comparison—that would otherwise require boilerplate assertion code. Suitable for any project using pytest that needs to validate complex or binary outputs.
Install
pytest-regressions on PyPI
pip
pip install pytest-regressionsuv
uv add pytest-regressionspoetry
poetry add pytest-regressionsInstalling pytest-regressions
Before you install
Low friction install with three lightweight runtime dependencies (pytest, pytest-datadir, pyyaml). Active maintenance: last commit 2026-07-27, release 81 days ago.
License in practice
MIT license (permissive): you can use this freely in commercial and private projects without restriction or attribution requirement.
Quickstart
pip install pytest-regressions
# In your test file:
import pytest
def test_output(data_regression):
result = some_function()
data_regression.check(result)
Requires Python 3.10 or later.
Verify before relying
- Exact API surface and supported data types (text, images, files, numeric tables) beyond the description excerpt.
- How baseline data is stored and managed in the data directory structure.
- Whether image comparison includes pixel-level tolerance or only exact matching.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — pytest-datadir, pytest, pyyaml |
| Maintenance | actively maintained — 81 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,026,806/month — #4,477 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_regressions-2.11.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-datadirA pytest plugin that provides fixtures for…
permissive · top 5,000 on PyPI
pytest-datafilesA pytest plugin that copies specified files and…
permissive · top 15,000 on PyPI
pytest-homeassistant-custom-componentProvides pytest fixtures and testing utilities…
permissive · top 5,000 on PyPI
pytest-mplpytest-mpl is a pytest plugin that automates…
permissive · top 15,000 on PyPI
pytest-snapshotA pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
pytest-localftpserverProvides pytest fixtures for running local FTP…
permissive · top 15,000 on PyPI
pytest-variablesA pytest plugin that loads test variables from…
copyleft · top 15,000 on PyPI
pytest-arraydiffA pytest plugin that generates and compares…
permissive · top 15,000 on PyPI
pytest-richA pytest plugin that uses rich to format and…
permissive · top 15,000 on PyPI
pytest-item-dictA pytest plugin that builds hierarchical…
unclear · top 15,000 on PyPI