Skip to content

Commit a300ee6

Browse files
committed
Increase a few test tolerances on some arches.
1 parent 10e4867 commit a300ee6

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,8 @@ def test_imshow():
10311031
ax.imshow("r", data=data)
10321032

10331033

1034-
@image_comparison(['imshow_clip'], style='mpl20')
1034+
@image_comparison(['imshow_clip'], style='mpl20',
1035+
tol=0 if platform.machine() == 'x86_64' else 1.24)
10351036
def test_imshow_clip():
10361037
# As originally reported by Gellule Xg <gellule.xg@free.fr>
10371038
# use former defaults to match existing baseline image
@@ -2340,7 +2341,8 @@ def test_contour_hatching():
23402341
extend='both', alpha=0.5)
23412342

23422343

2343-
@image_comparison(['contour_colorbar'], style='mpl20')
2344+
@image_comparison(['contour_colorbar'], style='mpl20',
2345+
tol=0 if platform.machine() == 'x86_64' else 0.02)
23442346
def test_contour_colorbar():
23452347
x, y, z = contour_dat()
23462348

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_pathclip():
169169
# test mixed mode rendering
170170
@needs_pgf_xelatex
171171
@pytest.mark.backend('pgf')
172-
@image_comparison(['pgf_mixedmode.pdf'], style='default')
172+
@image_comparison(['pgf_mixedmode.pdf'], style='default', tol=0.9)
173173
def test_mixedmode():
174174
mpl.rcParams.update({'font.family': 'serif', 'pgf.rcfonts': False})
175175
Y, X = np.ogrid[-1:1:40j, -1:1:40j]

lib/matplotlib/tests/test_colorbar.py

Lines changed: 4 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,8 @@ 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(['contour_colorbar.png'], remove_text=True,
239+
tol=0 if platform.machine() == 'x86_64' else 0.01)
237240
def test_contour_colorbar():
238241
fig, ax = plt.subplots(figsize=(4, 2))
239242
data = np.arange(1200).reshape(30, 40) - 500

lib/matplotlib/tests/test_contour.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ def test_contourf_log_extension():
341341

342342

343343
@image_comparison(['contour_addlines.png'],
344-
remove_text=True, style='mpl20', tol=0.03)
344+
remove_text=True, style='mpl20',
345+
tol=0.03 if platform.machine() == 'x86_64' else 0.15)
345346
# tolerance is because image changed minutely when tick finding on
346347
# colorbars was cleaned up...
347348
def test_contour_addlines():

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,8 +1323,8 @@ def test_nonuniform_and_pcolor():
13231323
ax.set(xlim=(0, 10))
13241324

13251325

1326-
@image_comparison(["rgba_antialias.png"], style="mpl20",
1327-
remove_text=True)
1326+
@image_comparison(["rgba_antialias.png"], style="mpl20", remove_text=True,
1327+
tol=0 if platform.machine() == 'x86_64' else 0.007)
13281328
def test_rgba_antialias():
13291329
fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
13301330
sharey=False, constrained_layout=True)

lib/matplotlib/tests/test_lines.py

Lines changed: 3 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

@@ -165,7 +166,8 @@ def test_set_drawstyle():
165166
assert len(line.get_path().vertices) == len(x)
166167

167168

168-
@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
169+
@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20',
170+
tol=0 if platform.machine() == 'x86_64' else 0.62)
169171
def test_set_line_coll_dash_image():
170172
fig, ax = plt.subplots()
171173
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)