feature request: python version dependent reference images

オープン
#264 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
matplotlib, python
領域
testing-qa

調査の方向性

まず、issueで言及されているmpl_image_compareデコレーターと--mpl-generate-pathオプションをたどることから始めます。現在ベースラインパスがどのように解決されているかを確認し、その後、Pythonバージョン固有のパスをどのように選択・生成するかを定義します。baselines/3.10やbaselines/3.13などの個別のベースラインを、バージョン間の比較失敗なしに使用できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

hi! I have a project with a CI/CD pipeline that runs pytest across different python versions, and today ran into a rather annoying issue where the matplotlib images on py3.10 are slightly different from py3.13 (text being offset by a few pixels). Now, if I regenerate the reference images on 3.10, the tests on 3.13 will fail, and the other way around as well.

I was hoping to be able to add python-version dependent reference images. Something like

@pytest.mark.mpl_image_compare(baseline_dir="baselines/{py_version}")
def test_my_plot():
...

which would detect the python version. Then the user (me) could run

pytest --mpl-generate-path=baselines/3.10

and

pytest --mpl-generate-path=baselines/3.13

if i need version dependent reference images.

edit: matplotlib 3.11 introduced a new text renderer that causes the mismatching images. The release notes https://matplotlib.org/stable/release/prev_whats_new/whats_new_3.11.0.html#fonts-and-text highlight a few workarounds. Adding here in case someone stumbles on this issue.

主要言語
Python
スター
274
フォーク
53
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

matplotlib/pytest-mpl のほかの issue

matplotlib/pytest-mpl の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。