Skip to content

Commit d1902a5

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR matplotlib#31946: TST: Increase some tolerances for non-x86_64 architectures
1 parent eeda0d0 commit d1902a5

7 files changed

Lines changed: 17 additions & 18 deletions

File tree

lib/matplotlib/tests/test_axes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def test_matshow(fig_test, fig_ref):
240240

241241

242242
@image_comparison([f'formatter_ticker_{i:03d}.png' for i in range(1, 6)], style='mpl20',
243-
tol=0.03 if sys.platform == 'darwin' else 0)
243+
tol=0 if platform.machine() == 'x86_64' else 0.03)
244244
def test_formatter_ticker():
245245
import matplotlib.testing.jpl_units as units
246246
units.register()
@@ -5611,7 +5611,7 @@ def test_marker_styles():
56115611

56125612

56135613
@image_comparison(['rc_markerfill.png'], style='mpl20',
5614-
tol=0.033 if sys.platform == 'darwin' else 0)
5614+
tol=0 if platform.machine() == 'x86_64' else 0.033)
56155615
def test_markers_fillstyle_rcparams():
56165616
fig, ax = plt.subplots()
56175617
x = np.arange(7)
@@ -5634,7 +5634,7 @@ def test_vertex_markers():
56345634

56355635

56365636
@image_comparison(['vline_hline_zorder.png', 'errorbar_zorder.png'], style='mpl20',
5637-
tol=0.02 if sys.platform == 'darwin' else 0)
5637+
tol=0 if platform.machine() == 'x86_64' else 0.02)
56385638
def test_eb_line_zorder():
56395639
x = list(range(10))
56405640

@@ -6666,7 +6666,7 @@ def test_pie_linewidth_0():
66666666

66676667

66686668
@image_comparison(['pie_center_radius.png'], style='mpl20',
6669-
tol=0.01 if sys.platform == 'darwin' else 0)
6669+
tol=0 if platform.machine() == 'x86_64' else 0.01)
66706670
def test_pie_center_radius():
66716671
# The slices will be ordered and plotted counter-clockwise.
66726672
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
@@ -9857,7 +9857,7 @@ def test_zorder_and_explicit_rasterization():
98579857

98589858

98599859
@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
9860-
tol=0.01 if sys.platform == 'darwin' else 0)
9860+
tol=0 if platform.machine() == 'x86_64' else 0.01)
98619861
def test_preset_clip_paths():
98629862
fig, ax = plt.subplots()
98639863

lib/matplotlib/tests/test_figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ def test_subfigure_dpi():
13971397

13981398
@image_comparison(['test_subfigure_ss.png'], style='mpl20',
13991399
savefig_kwarg={'facecolor': 'teal'},
1400-
tol=0.022 if sys.platform == 'darwin' else 0)
1400+
tol=0 if platform.machine() == 'x86_64' else 0.022)
14011401
def test_subfigure_ss():
14021402
# test assigning the subfigure via subplotspec
14031403
np.random.seed(19680801)

lib/matplotlib/tests/test_legend.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import io
33
import itertools
44
import platform
5-
import sys
65
import time
76
from unittest import mock
87
import warnings
@@ -203,7 +202,7 @@ def test_alpha_rcparam():
203202

204203

205204
@image_comparison(['fancy.png'], remove_text=True, style='mpl20',
206-
tol=0.01 if sys.platform == 'darwin' else 0)
205+
tol=0 if platform.machine() == 'x86_64' else 0.01)
207206
def test_fancy():
208207
# using subplot triggers some offsetbox functionality untested elsewhere
209208
plt.subplot(121)
@@ -665,7 +664,7 @@ def test_empty_bar_chart_with_legend():
665664

666665

667666
@image_comparison(['shadow_argument_types.png'], remove_text=True, style='mpl20',
668-
tol=0.028 if sys.platform == 'darwin' else 0)
667+
tol=0 if platform.machine() == 'x86_64' else 0.028)
669668
def test_shadow_argument_types():
670669
# Test that different arguments for shadow work as expected
671670
fig, ax = plt.subplots()

lib/matplotlib/tests/test_patheffects.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys
1+
import platform
22

33
import numpy as np
44

@@ -30,7 +30,7 @@ def test_patheffect1():
3030

3131

3232
@image_comparison(['patheffect2'], remove_text=True, style='mpl20',
33-
tol=0.051 if sys.platform == 'darwin' else 0)
33+
tol=0 if platform.machine() == 'x86_64' else 0.051)
3434
def test_patheffect2():
3535

3636
ax2 = plt.subplot()
@@ -46,7 +46,7 @@ def test_patheffect2():
4646

4747

4848
@image_comparison(['patheffect3'], style='mpl20',
49-
tol=0.02 if sys.platform == 'darwin' else 0)
49+
tol=0 if platform.machine() == 'x86_64' else 0.02)
5050
def test_patheffect3():
5151
plt.figure(figsize=(8, 6))
5252
p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)

lib/matplotlib/tests/test_polar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys
1+
import platform
22

33
import numpy as np
44
from numpy.testing import assert_allclose
@@ -12,7 +12,7 @@
1212

1313

1414
@image_comparison(['polar_axes.png'], style='default',
15-
tol=0.009 if sys.platform == 'darwin' else 0)
15+
tol=0 if platform.machine() == 'x86_64' else 0.009)
1616
def test_polar_annotations():
1717
# You can specify the xypoint and the xytext in different positions and
1818
# coordinate systems, and optionally turn on a connecting line and mark the
@@ -47,7 +47,7 @@ def test_polar_annotations():
4747

4848

4949
@image_comparison(['polar_coords.png'], style='default', remove_text=True,
50-
tol=0.013 if sys.platform == 'darwin' else 0)
50+
tol=0 if platform.machine() == 'x86_64' else 0.013)
5151
def test_polar_coord_annotations():
5252
# You can also use polar notation on a cartesian axes. Here the native
5353
# coordinate system ('data') is cartesian, so you need to specify the

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ def test_errorbar3d_errorevery():
17241724

17251725

17261726
@mpl3d_image_comparison(['errorbar3d.png'], style='mpl20',
1727-
tol=0.015 if sys.platform == 'darwin' else 0)
1727+
tol=0 if platform.machine() == 'x86_64' else 0.015)
17281728
def test_errorbar3d():
17291729
"""Tests limits, color styling, and legend for 3D errorbars."""
17301730
fig = plt.figure()

lib/mpl_toolkits/mplot3d/tests/test_legend3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys
1+
import platform
22

33
import numpy as np
44

@@ -28,7 +28,7 @@ def test_legend_bar():
2828

2929

3030
@image_comparison(['fancy.png'], remove_text=True, style='mpl20',
31-
tol=0.01 if sys.platform == 'darwin' else 0)
31+
tol=0 if platform.machine() == 'x86_64' else 0.01)
3232
def test_fancy():
3333
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
3434
ax.plot(np.arange(10), np.full(10, 5), np.full(10, 5), 'o--', label='line')

0 commit comments

Comments
 (0)