Skip to content

Commit a0442f4

Browse files
authored
Merge pull request #24786 from QuLogic/arm-tolerance
Increase a few test tolerances on some arches
2 parents 6091437 + d5da1ff commit a0442f4

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,9 @@ def test_imshow():
10321032
ax.imshow("r", data=data)
10331033

10341034

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

23542356

2355-
@image_comparison(['contour_colorbar'], style='mpl20')
2357+
@image_comparison(
2358+
['contour_colorbar'], style='mpl20',
2359+
tol=0.02 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
23562360
def test_contour_colorbar():
23572361
x, y, z = contour_dat()
23582362

lib/matplotlib/tests/test_colorbar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import platform
2+
13
import numpy as np
24
import pytest
35

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

235237

236-
@image_comparison(['contour_colorbar.png'], remove_text=True)
238+
@image_comparison(
239+
['contour_colorbar.png'], remove_text=True,
240+
tol=0.01 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
237241
def test_contour_colorbar():
238242
fig, ax = plt.subplots(figsize=(4, 2))
239243
data = np.arange(1200).reshape(30, 40) - 500

lib/matplotlib/tests/test_contour.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,10 @@ def test_contourf_log_extension():
318318
cb = plt.colorbar(c3, ax=ax3)
319319

320320

321-
@image_comparison(['contour_addlines.png'],
322-
remove_text=True, style='mpl20', tol=0.03)
321+
@image_comparison(
322+
['contour_addlines.png'], remove_text=True, style='mpl20',
323+
tol=0.15 if platform.machine() in ('aarch64', 'ppc64le', 's390x')
324+
else 0.03)
323325
# tolerance is because image changed minutely when tick finding on
324326
# colorbars was cleaned up...
325327
def test_contour_addlines():

lib/matplotlib/tests/test_image.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,8 +1337,9 @@ def test_nonuniform_and_pcolor():
13371337
ax.set(xlim=(0, 10))
13381338

13391339

1340-
@image_comparison(["rgba_antialias.png"], style="mpl20",
1341-
remove_text=True)
1340+
@image_comparison(
1341+
['rgba_antialias.png'], style='mpl20', remove_text=True,
1342+
tol=0.007 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
13421343
def test_rgba_antialias():
13431344
fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
13441345
sharey=False, constrained_layout=True)

lib/matplotlib/tests/test_lines.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import itertools
6+
import platform
67
import timeit
78
from types import SimpleNamespace
89

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

180181

181-
@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
182+
@image_comparison(
183+
['line_collection_dashes'], remove_text=True, style='mpl20',
184+
tol=0.62 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
182185
def test_set_line_coll_dash_image():
183186
fig, ax = plt.subplots()
184187
np.random.seed(0)

lib/matplotlib/tests/test_mathtext.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import io
22
from pathlib import Path
3+
import platform
34
import re
45
import shlex
56
from xml.etree import ElementTree as ET
@@ -198,7 +199,8 @@ def baseline_images(request, fontset, index, text):
198199
@pytest.mark.parametrize(
199200
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
200201
@pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True)
201-
@image_comparison(baseline_images=None)
202+
@image_comparison(baseline_images=None,
203+
tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
202204
def test_mathtext_rendering(baseline_images, fontset, index, text):
203205
mpl.rcParams['mathtext.fontset'] = fontset
204206
fig = plt.figure(figsize=(5.25, 0.75))
@@ -239,7 +241,8 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text):
239241
@pytest.mark.parametrize(
240242
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
241243
@pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True)
242-
@image_comparison(baseline_images=None, extensions=['png'])
244+
@image_comparison(baseline_images=None, extensions=['png'],
245+
tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0)
243246
def test_mathfont_rendering(baseline_images, fontset, index, text):
244247
mpl.rcParams['mathtext.fontset'] = fontset
245248
fig = plt.figure(figsize=(5.25, 0.75))

0 commit comments

Comments
 (0)