matplotlib / matplotlib/pytest-mpl

How to deal with multiple valid test results

Open
#149 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
272
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Depending on the version of matplotlib, the way it was installed, the way other dependencies were installed and a bunch of other random factors, the results of our image comparison tests can vary slightly.
Enough to fall way out of the tolerance window, but still being perfectly valid results.

So we have a set of multiple valid baseline images for most of our tests, but don't really have a good way to actually test if any of them matches.

Right now, we are using our own fork of pytest-mpl, which does support testing against multiple baselines: https://github.com/OGGM/pytest-mpl
But maintaining that has been a consistent pain, and it's getting harder the more upstream pytest-mpl evolves.

This must be a general issue not only we have. What is the proper way to deal with it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing pytest-mpl image-comparison behavior and the linked OGGM/pytest-mpl fork that supports multiple baselines. Clarify how candidate baselines should be selected and what constitutes a match; done would mean a documented, maintainable approach that tests against multiple valid images without relying on the fork.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.