skillfed

pytest-regressions

Easy to use fixtures to write regression tests.

pytest-regressions v2.11.0 1.0M downloads/30d#4,477 on PyPI221
Permissive license MIT Active released

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-regressions

uv

uv add pytest-regressions

poetry

poetry add pytest-regressions

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Testing

Tags

regression testing pytestbaseline comparison testinggolden file testingpytest fixtures data comparisonsnapshot testing pytesttest output validation
regression-testingpytest-pluginbaseline-comparison

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

pytest-datadir

A pytest plugin that provides fixtures for…

permissive · top 5,000 on PyPI

pytest-datafiles

A pytest plugin that copies specified files and…

permissive · top 15,000 on PyPI

pytest-homeassistant-custom-component

Provides pytest fixtures and testing utilities…

permissive · top 5,000 on PyPI

pytest-mpl

pytest-mpl is a pytest plugin that automates…

permissive · top 15,000 on PyPI

pytest-snapshot

A pytest plugin that enables snapshot…

permissive · top 5,000 on PyPI

pytest-localftpserver

Provides pytest fixtures for running local FTP…

permissive · top 15,000 on PyPI

pytest-variables

A pytest plugin that loads test variables from…

copyleft · top 15,000 on PyPI

pytest-arraydiff

A pytest plugin that generates and compares…

permissive · top 15,000 on PyPI

pytest-rich

A pytest plugin that uses rich to format and…

permissive · top 15,000 on PyPI

pytest-item-dict

A pytest plugin that builds hierarchical…

unclear · top 15,000 on PyPI