{"categories":[{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing/2"},{"label":"Visualization","url":"https://skillfed.io/packages/category/scientific-engineering-visualization"}],"enrichment":{"capability":"pytest-mpl is a pytest plugin that automates visual regression testing for Matplotlib figures by comparing generated images against reference baselines using RMS tolerance or hash comparison.","skillfed_tags":["matplotlib-testing","visual-regression","pytest-plugin"],"use_cases":["Catch unintended changes to scientific plots or data visualizations in CI/CD pipelines","Verify that refactored plotting code produces identical visual output before and after","Maintain visual regression baselines for library documentation or gallery examples","Test custom Matplotlib extensions or themes to ensure consistent rendering across versions","Validate plot appearance across different environments or backend configurations"],"what_it_does":"pytest-mpl bridges the gap between Matplotlib figure generation and automated testing by letting you write test functions that return figures, then comparing their rendered output against stored reference images. It handles the visual regression workflow: generate a baseline set of reference images once, then on subsequent test runs, render new figures and measure the difference (either by RMS of pixel residuals or by hash). If the difference exceeds your tolerance threshold, the test fails, catching unintended changes to plots.\n\nThe plugin integrates directly into pytest's test discovery and marking system. You decorate test functions with `@pytest.mark.mpl_image_compare`, and pytest-mpl intercepts them, renders the returned figure to an image, and compares it. It depends on pytest for the test framework, matplotlib for rendering, Pillow for image I/O, Jinja2 for HTML report generation, and packaging for version handling. It's designed for projects that need to ensure plot outputs remain visually consistent across code changes.","worth_installing":"Yes, if you maintain Matplotlib-heavy code and need automated visual regression testing. The plugin is actively maintained, has no known vulnerabilities, installs with low friction, and integrates seamlessly into pytest workflows. The BSD-2-Clause license is permissive. Install it if visual consistency of plots is part of your test suite; skip it if you don't generate or test figures programmatically."},"id":"pytest-mpl","links":{"html":"https://skillfed.io/packages/pytest-mpl","md":"https://skillfed.io/packages/pytest-mpl.md","pypi":"https://pypi.org/project/pytest-mpl/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-03-25","license_spdx":"BSD-2-Clause","license_treatment":"permissive","name":"pytest-mpl","python_support":"supports_current","summary":"pytest plugin to help with testing figures output from Matplotlib"},"popularity":{"monthly_downloads":677495,"position":5380,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.19.0"}
