Skip to content

Increase a few test tolerances on some arches #24786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,9 @@ def test_imshow():
ax.imshow("r", data=data)


@image_comparison(['imshow_clip'], style='mpl20')
@image_comparison(
['imshow_clip'], style='mpl20',
tol=1.24 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
def test_imshow_clip():
# As originally reported by Gellule Xg <gellule.xg@free.fr>
# use former defaults to match existing baseline image
Expand Down Expand Up @@ -2352,7 +2354,9 @@ def test_contour_hatching():
extend='both', alpha=0.5)


@image_comparison(['contour_colorbar'], style='mpl20')
@image_comparison(
['contour_colorbar'], style='mpl20',
tol=0.02 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
def test_contour_colorbar():
x, y, z = contour_dat()

Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/tests/test_colorbar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import platform

import numpy as np
import pytest

Expand Down Expand Up @@ -233,7 +235,9 @@ def test_colorbar_single_ax_panchor_east(constrained):
assert ax.get_anchor() == 'E'


@image_comparison(['contour_colorbar.png'], remove_text=True)
@image_comparison(
['contour_colorbar.png'], remove_text=True,
tol=0.01 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
def test_contour_colorbar():
fig, ax = plt.subplots(figsize=(4, 2))
data = np.arange(1200).reshape(30, 40) - 500
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,10 @@ def test_contourf_log_extension():
cb = plt.colorbar(c3, ax=ax3)


@image_comparison(['contour_addlines.png'],
remove_text=True, style='mpl20', tol=0.03)
@image_comparison(
['contour_addlines.png'], remove_text=True, style='mpl20',
tol=0.15 if platform.machine() in ('aarch64', 'ppc64le', 's390x')
else 0.03)
# tolerance is because image changed minutely when tick finding on
# colorbars was cleaned up...
def test_contour_addlines():
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,9 @@ def test_nonuniform_and_pcolor():
ax.set(xlim=(0, 10))


@image_comparison(["rgba_antialias.png"], style="mpl20",
remove_text=True)
@image_comparison(
['rgba_antialias.png'], style='mpl20', remove_text=True,
tol=0.007 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
def test_rgba_antialias():
fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
sharey=False, constrained_layout=True)
Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/tests/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import itertools
import platform
import timeit
from types import SimpleNamespace

Expand Down Expand Up @@ -178,7 +179,9 @@ def test_set_drawstyle():
assert len(line.get_path().vertices) == len(x)


@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
@image_comparison(
['line_collection_dashes'], remove_text=True, style='mpl20',
tol=0.62 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
def test_set_line_coll_dash_image():
fig, ax = plt.subplots()
np.random.seed(0)
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/tests/test_mathtext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
from pathlib import Path
import platform
import re
import shlex
from xml.etree import ElementTree as ET
Expand Down Expand Up @@ -198,7 +199,8 @@ def baseline_images(request, fontset, index, text):
@pytest.mark.parametrize(
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
@pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True)
@image_comparison(baseline_images=None)
@image_comparison(baseline_images=None,
tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
def test_mathtext_rendering(baseline_images, fontset, index, text):
mpl.rcParams['mathtext.fontset'] = fontset
fig = plt.figure(figsize=(5.25, 0.75))
Expand Down Expand Up @@ -239,7 +241,8 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
@pytest.mark.parametrize(
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)
@image_comparison(baseline_images=None, extensions=['png'])
@image_comparison(baseline_images=None, extensions=['png'],
tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
def test_mathfont_rendering(baseline_images, fontset, index, text):
mpl.rcParams['mathtext.fontset'] = fontset
fig = plt.figure(figsize=(5.25, 0.75))
Expand Down