Skip to main content

pytest-mpl-oggm

pytest-mpl is a pytest plugin to facilitate image comparison for Matplotlib figures.

OGGM fork

pytest-mpl-oggm` is a shallow fork that adds a few OGGM specific features and enhancements.

Installation:

pip install pytest-mpl-oggm

To run the tests, pass --mpl-oggm to compare the returned figures to the reference images:

pytest --mpl-oggm

For more information about this fork, visit https://github.com/OGGM/pytest-mpl-oggm

Upstream pytest-mpl

For each figure to test, an image is generated and then subtracted from an existing reference image. If the RMS of the residual is larger than a user-specified tolerance, the test will fail. Alternatively, the generated image can be hashed and compared to an expected value.

For more information, see the pytest-mpl documentation.

Usage

First, write test functions that create a figure. These image comparison tests are decorated with @pytest.mark.mpl_image_compare and return the figure for testing:

import matplotlib.pyplot as plt
import pytest

@pytest.mark.mpl_image_compare
def test_plot():
    fig, ax = plt.subplots()
    ax.plot([1, 2])
    return fig

Then, generate reference images by running the test suite with the --mpl-generate-path option:

pytest --mpl-generate-path=baseline

Then, run the test suite as usual, but pass --mpl to compare the returned figures to the reference images:

pytest --mpl

By also passing --mpl-generate-summary=html, a summary of the image comparison results will be generated in HTML format:

html all

html filter

html result

For more information on how to configure and use pytest-mpl, see the pytest-mpl documentation.

Contributing

pytest-mpl is a community project maintained for and by its users. There are many ways you can help!

  • Report a bug or request a feature on GitHub

  • Improve the documentation or code

Metadata

Release files for pytest-mpl-oggm 0.180.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-mpl-oggm 0.180.2
File Size Uploaded Provenance Actions
pytest_mpl_oggm-0.180.2.tar.gz 882.2 kB Without provenance Details for pytest_mpl_oggm-0.180.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-mpl-oggm 0.180.2
File Interpreter ABI Platform Actions
pytest_mpl_oggm-0.180.2-py3-none-any.whl Python 3 none any Details for pytest_mpl_oggm-0.180.2-py3-none-any.whl

Total release size: 911.0 kB

Release files / pytest_mpl_oggm-0.180.2.tar.gz

Download URL pytest_mpl_oggm-0.180.2.tar.gz
Size 882.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9a33d0d11d60c3f36457689120ec31ee5601bb51db7c9e8502c75bd09edd67a
BLAKE2b-256 checksum
How to use checksums
587f3be9599a22d17db6087ba01449fdc4094947135ca43ea751f17167399100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / pytest_mpl_oggm-0.180.2-py3-none-any.whl

Download URL pytest_mpl_oggm-0.180.2-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8901c9db4d6a3f4ad3433f325a6ca419835104d2f0968b9b62795390cb9dc89
BLAKE2b-256 checksum
How to use checksums
d30781afe76e338260b0926f67561df2067128f08aa6221be6d60c7a9f965931
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for pytest-mpl-oggm 0.180.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.180.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page