pytest-arraydiff
pytest plugin to help with comparing array output from tests
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained plugin (last release 73 days ago, no vulnerabilities) that solves a real problem in numerical testing. Install friction is minimal, the license is permissive, and it integrates seamlessly into pytest workflows. Recommended for any project with large array outputs that need regression testing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; pytest and numpy must be installed.
- Low friction install with just pytest and numpy as runtime dependencies.
- The package is actively maintained with a recent release and no known vulnerabilities.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is a permissive license; you can use this package freely in commercial or private projects with minimal restrictions.
last release 2026-06-02 (73 days) · last repo commit 2026-08-02 · 27 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 344,276 downloads/mo, #7,376 on PyPI
Alternatives
Verify before relying
pip install pytest-arraydiff
import pytest
import numpy as np
@pytest.mark.array_compare
def test_succeeds():
return np.arange(3 * 5 * 4).reshape((3, 5, 4))
# Generate reference: py.test --arraydiff-generate-path=reference
# Compare against reference: py.test --arraydiff- Whether pandas and astropy are optional or required for HDF5 and FITS format support respectively.
- Performance characteristics when comparing very large arrays or many test files.
What it is and what it does
pytest-arraydiff is a pytest plugin that solves the problem of testing code that produces large numerical arrays—arrays too big to hard-code expected values directly in test assertions. Instead of writing `assert_allclose(result, [1, 2, 3])` for megabyte-sized outputs, you mark a test function with `@pytest.mark.array_compare`, have it return a numpy array or pandas DataFrame, and the plugin handles the rest. On first run, you generate reference files in your chosen format (plain text, FITS, or HDF5); on subsequent runs, the plugin compares new outputs to those references within configurable tolerances.
The plugin integrates directly into pytest's test discovery and reporting, so failures show side-by-side diffs of the generated and reference arrays. It's designed for scientific and data-heavy test suites where manual validation of large outputs is impractical, and where you want regression detection without maintaining brittle hard-coded assertions.
Use it for
- Regression testing for numerical simulation or data processing pipelines that produce large arrays.
- Validating scientific code outputs (e.g., astronomy, physics, machine learning) against known-good reference data.
- Testing pandas DataFrame transformations by storing and comparing output DataFrames in HDF5 format.
- Detecting unintended changes in array-producing functions across refactors or dependency updates.
- Storing FITS format reference data for astronomical or imaging test suites using astropy.
- Comparing multi-dimensional numpy arrays with floating-point tolerance thresholds to avoid brittle exact-match tests.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained plugin (last release 73 days ago, no vulnerabilities) that solves a real problem in numerical testing. Install friction is minimal, the license is permissive, and it integrates seamlessly into pytest workflows. Recommended for any project with large array outputs that need regression testing.
Install
pytest-arraydiff on PyPI
Before you install
Low friction install with just pytest and numpy as runtime dependencies. The package is actively maintained with a recent release and no known vulnerabilities.
Requires Python 3.9 or later; pytest and numpy must be installed.
License in practice
BSD-3-Clause is a permissive license; you can use this package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install pytest-arraydiff
import pytest
import numpy as np
@pytest.mark.array_compare
def test_succeeds():
return np.arange(3 * 5 * 4).reshape((3, 5, 4))
# Generate reference: py.test --arraydiff-generate-path=reference
# Compare against reference: py.test --arraydiff
Verify before relying
- Whether pandas and astropy are optional or required for HDF5 and FITS format support respectively.
- Performance characteristics when comparing very large arrays or many test files.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytestnumpy |
| Maintenance | Actively maintained 73 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 344,276 / month, #7,376 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_arraydiff-0.7.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 › “pytest array comparison testing”
- pytest-arraydiffA pytest plugin that generates and compares numpy arrays (and related…
- pytest-astropyA meta-package that bundles pytest plugins and testing libraries used…
- pytest-regressionsProvides pytest fixtures for writing regression tests that compare…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
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.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also recursive-diff · pytest-regressions · pytest-filter-subpackage · pytest-excel · pytest-progress · pytest-astropy · numpydantic · datacompy · pyjson · pytest-mpl