Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 001ef1b

Browse filesBrowse files
committed
TST: Increase tolerances for M1 machines
These are mostly just single bit changes in antialiasing portions of diagonal lines.
1 parent fd336af commit 001ef1b
Copy full SHA for 001ef1b
Expand file treeCollapse file tree

24 files changed

+104
-67
lines changed

‎lib/matplotlib/tests/test_arrow_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_arrow_patches.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def draw_arrow(ax, t, r):
1111
fc="b", ec='k'))
1212

1313

14-
@image_comparison(['fancyarrow_test_image'])
14+
@image_comparison(['fancyarrow_test_image'],
15+
tol=0.012 if platform.machine() == 'arm64' else 0)
1516
def test_fancyarrow():
1617
# Added 0 to test division by zero error described in issue 3930
1718
r = [0.4, 0.3, 0.2, 0.1, 0]
@@ -115,7 +116,7 @@ def test_fancyarrow_dash():
115116

116117

117118
@image_comparison(['arrow_styles.png'], style='mpl20', remove_text=True,
118-
tol=0 if platform.machine() == 'x86_64' else 0.005)
119+
tol=0 if platform.machine() == 'x86_64' else 0.02)
119120
def test_arrow_styles():
120121
styles = mpatches.ArrowStyle.get_styles()
121122

@@ -147,7 +148,8 @@ def test_arrow_styles():
147148
ax.add_patch(patch)
148149

149150

150-
@image_comparison(['connection_styles.png'], style='mpl20', remove_text=True)
151+
@image_comparison(['connection_styles.png'], style='mpl20', remove_text=True,
152+
tol=0.013 if platform.machine() == 'arm64' else 0)
151153
def test_connection_styles():
152154
styles = mpatches.ConnectionStyle.get_styles()
153155

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+25-15Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ def test_matshow(fig_test, fig_ref):
237237
'formatter_ticker_003',
238238
'formatter_ticker_004',
239239
'formatter_ticker_005',
240-
])
240+
],
241+
tol=0.031 if platform.machine() == 'arm64' else 0)
241242
def test_formatter_ticker():
242243
import matplotlib.testing.jpl_units as units
243244
units.register()
@@ -437,7 +438,8 @@ def test_twin_logscale(fig_test, fig_ref, twin):
437438
remove_ticks_and_titles(fig_ref)
438439

439440

440-
@image_comparison(['twin_autoscale.png'])
441+
@image_comparison(['twin_autoscale.png'],
442+
tol=0.009 if platform.machine() == 'arm64' else 0)
441443
def test_twinx_axis_scales():
442444
x = np.array([0, 0.5, 1])
443445
y = 0.5 * x
@@ -1232,7 +1234,8 @@ def test_fill_betweenx_input(y, x1, x2):
12321234
ax.fill_betweenx(y, x1, x2)
12331235

12341236

1235-
@image_comparison(['fill_between_interpolate'], remove_text=True)
1237+
@image_comparison(['fill_between_interpolate'], remove_text=True,
1238+
tol=0.012 if platform.machine() == 'arm64' else 0)
12361239
def test_fill_between_interpolate():
12371240
x = np.arange(0.0, 2, 0.02)
12381241
y1 = np.sin(2*np.pi*x)
@@ -1623,7 +1626,7 @@ def test_pcolorauto(fig_test, fig_ref, snap):
16231626
ax.pcolormesh(x2, y2, Z, snap=snap)
16241627

16251628

1626-
@image_comparison(['canonical'])
1629+
@image_comparison(['canonical'], tol=0.02 if platform.machine() == 'arm64' else 0)
16271630
def test_canonical():
16281631
fig, ax = plt.subplots()
16291632
ax.plot([1, 2, 3])
@@ -3065,7 +3068,8 @@ def test_log_scales_invalid():
30653068
ax.set_ylim(-1, 10)
30663069

30673070

3068-
@image_comparison(['stackplot_test_image', 'stackplot_test_image'])
3071+
@image_comparison(['stackplot_test_image', 'stackplot_test_image'],
3072+
tol=0.031 if platform.machine() == 'arm64' else 0)
30693073
def test_stackplot():
30703074
fig = plt.figure()
30713075
x = np.linspace(0, 10, 10)
@@ -4873,7 +4877,8 @@ def test_marker_styles():
48734877
marker=marker, markersize=10+y/5, label=marker)
48744878

48754879

4876-
@image_comparison(['rc_markerfill.png'])
4880+
@image_comparison(['rc_markerfill.png'],
4881+
tol=0.037 if platform.machine() == 'arm64' else 0)
48774882
def test_markers_fillstyle_rcparams():
48784883
fig, ax = plt.subplots()
48794884
x = np.arange(7)
@@ -4896,7 +4901,7 @@ def test_vertex_markers():
48964901

48974902

48984903
@image_comparison(['vline_hline_zorder', 'errorbar_zorder'],
4899-
tol=0 if platform.machine() == 'x86_64' else 0.02)
4904+
tol=0 if platform.machine() == 'x86_64' else 0.026)
49004905
def test_eb_line_zorder():
49014906
x = list(range(10))
49024907

@@ -5455,7 +5460,8 @@ def test_twin_remove(fig_test, fig_ref):
54555460
ax_ref.yaxis.tick_left()
54565461

54575462

5458-
@image_comparison(['twin_spines.png'], remove_text=True)
5463+
@image_comparison(['twin_spines.png'], remove_text=True,
5464+
tol=0.022 if platform.machine() == 'arm64' else 0)
54595465
def test_twin_spines():
54605466

54615467
def make_patch_spines_invisible(ax):
@@ -5822,7 +5828,7 @@ def test_pie_linewidth_0():
58225828
plt.axis('equal')
58235829

58245830

5825-
@image_comparison(['pie_center_radius.png'], style='mpl20', tol=0.005)
5831+
@image_comparison(['pie_center_radius.png'], style='mpl20', tol=0.007)
58265832
def test_pie_center_radius():
58275833
# The slices will be ordered and plotted counter-clockwise.
58285834
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
@@ -6008,7 +6014,8 @@ def test_pie_hatch_multi(fig_test, fig_ref):
60086014
[w.set_hatch(hp) for w, hp in zip(wedges, hatch)]
60096015

60106016

6011-
@image_comparison(['set_get_ticklabels.png'])
6017+
@image_comparison(['set_get_ticklabels.png'],
6018+
tol=0.025 if platform.machine() == 'arm64' else 0)
60126019
def test_set_get_ticklabels():
60136020
# test issue 2246
60146021
fig, ax = plt.subplots(2)
@@ -6579,7 +6586,8 @@ def test_loglog():
65796586
ax.tick_params(length=15, width=2, which='minor')
65806587

65816588

6582-
@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20')
6589+
@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20',
6590+
tol=0.029 if platform.machine() == 'arm64' else 0)
65836591
def test_loglog_nonpos():
65846592
fig, axs = plt.subplots(3, 3)
65856593
x = np.arange(1, 11)
@@ -7505,8 +7513,8 @@ def test_scatter_empty_data():
75057513
plt.scatter([], [], s=[], c=[])
75067514

75077515

7508-
@image_comparison(['annotate_across_transforms.png'],
7509-
style='mpl20', remove_text=True)
7516+
@image_comparison(['annotate_across_transforms.png'], style='mpl20', remove_text=True,
7517+
tol=0.025 if platform.machine() == 'arm64' else 0)
75107518
def test_annotate_across_transforms():
75117519
x = np.linspace(0, 10, 200)
75127520
y = np.exp(-x) * np.sin(x)
@@ -7536,7 +7544,8 @@ def inverted(self):
75367544
return _Translation(-self.dx)
75377545

75387546

7539-
@image_comparison(['secondary_xy.png'], style='mpl20')
7547+
@image_comparison(['secondary_xy.png'], style='mpl20',
7548+
tol=0.027 if platform.machine() == 'arm64' else 0)
75407549
def test_secondary_xy():
75417550
fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)
75427551

@@ -8799,7 +8808,8 @@ def test_zorder_and_explicit_rasterization():
87998808
fig.savefig(b, format='pdf')
88008809

88018810

8802-
@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20")
8811+
@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
8812+
tol=0.027 if platform.machine() == "arm64" else 0)
88038813
def test_preset_clip_paths():
88048814
fig, ax = plt.subplots()
88058815

‎lib/matplotlib/tests/test_bbox_tight.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_bbox_tight.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from io import BytesIO
2+
import platform
23

34
import numpy as np
45

@@ -43,7 +44,8 @@ def test_bbox_inches_tight():
4344

4445

4546
@image_comparison(['bbox_inches_tight_suptile_legend'],
46-
savefig_kwarg={'bbox_inches': 'tight'})
47+
savefig_kwarg={'bbox_inches': 'tight'},
48+
tol=0.02 if platform.machine() == 'arm64' else 0)
4749
def test_bbox_inches_tight_suptile_legend():
4850
plt.plot(np.arange(10), label='a straight line')
4951
plt.legend(bbox_to_anchor=(0.9, 1), loc='upper left')

‎lib/matplotlib/tests/test_collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_collections.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22
import io
33
import itertools
4+
import platform
45
import re
56
from types import SimpleNamespace
67

@@ -388,7 +389,8 @@ def test_barb_limits():
388389
decimal=1)
389390

390391

391-
@image_comparison(['EllipseCollection_test_image.png'], remove_text=True)
392+
@image_comparison(['EllipseCollection_test_image.png'], remove_text=True,
393+
tol=0.021 if platform.machine() == 'arm64' else 0)
392394
def test_EllipseCollection():
393395
# Test basic functionality
394396
fig, ax = plt.subplots()

‎lib/matplotlib/tests/test_colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colorbar.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ def test_colorbar_single_ax_panchor_east(constrained):
234234
assert ax.get_anchor() == 'E'
235235

236236

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

‎lib/matplotlib/tests/test_constrainedlayout.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_constrainedlayout.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import gc
2+
import platform
3+
24
import numpy as np
35
import pytest
46

@@ -195,7 +197,8 @@ def test_constrained_layout9():
195197
fig.suptitle('Test Suptitle', fontsize=28)
196198

197199

198-
@image_comparison(['constrained_layout10.png'])
200+
@image_comparison(['constrained_layout10.png'],
201+
tol=0.032 if platform.machine() == 'arm64' else 0)
199202
def test_constrained_layout10():
200203
"""Test for handling legend outside axis"""
201204
fig, axs = plt.subplots(2, 2, layout="constrained")

‎lib/matplotlib/tests/test_contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_contour.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def test_contour_label_with_disconnected_segments(split_collections):
164164

165165

166166
@pytest.mark.parametrize("split_collections", [False, True])
167-
@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True)
167+
@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True,
168+
tol=0.018 if platform.machine() == 'arm64' else 0)
168169
def test_given_colors_levels_and_extends(split_collections):
169170
# Remove this line when this test image is regenerated.
170171
plt.rcParams['pcolormesh.snap'] = False

‎lib/matplotlib/tests/test_figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_figure.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ def test_clf_keyword():
160160
assert [t.get_text() for t in fig2.texts] == []
161161

162162

163-
@image_comparison(['figure_today'])
163+
@image_comparison(['figure_today'],
164+
tol=0.015 if platform.machine() == 'arm64' else 0)
164165
def test_figure():
165166
# named figure support
166167
fig = plt.figure('today')

‎lib/matplotlib/tests/test_image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_image.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ def test_nonuniform_and_pcolor():
14081408

14091409
@image_comparison(
14101410
['rgba_antialias.png'], style='mpl20', remove_text=True,
1411-
tol=0.007 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
1411+
tol=0 if platform.machine() == 'x86_64' else 0.007)
14121412
def test_rgba_antialias():
14131413
fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
14141414
sharey=False, constrained_layout=True)

‎lib/matplotlib/tests/test_legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_legend.py
+11-8Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def test_legend_label_with_leading_underscore():
151151
assert len(legend.legend_handles) == 0
152152

153153

154-
@image_comparison(['legend_labels_first.png'], remove_text=True)
154+
@image_comparison(['legend_labels_first.png'], remove_text=True,
155+
tol=0.013 if platform.machine() == 'arm64' else 0)
155156
def test_labels_first():
156157
# test labels to left of markers
157158
fig, ax = plt.subplots()
@@ -161,7 +162,8 @@ def test_labels_first():
161162
ax.legend(loc='best', markerfirst=False)
162163

163164

164-
@image_comparison(['legend_multiple_keys.png'], remove_text=True)
165+
@image_comparison(['legend_multiple_keys.png'], remove_text=True,
166+
tol=0.013 if platform.machine() == 'arm64' else 0)
165167
def test_multiple_keys():
166168
# test legend entries with multiple keys
167169
fig, ax = plt.subplots()
@@ -175,7 +177,7 @@ def test_multiple_keys():
175177

176178

177179
@image_comparison(['rgba_alpha.png'], remove_text=True,
178-
tol=0 if platform.machine() == 'x86_64' else 0.01)
180+
tol=0 if platform.machine() == 'x86_64' else 0.03)
179181
def test_alpha_rgba():
180182
fig, ax = plt.subplots()
181183
ax.plot(range(10), lw=5)
@@ -184,7 +186,7 @@ def test_alpha_rgba():
184186

185187

186188
@image_comparison(['rcparam_alpha.png'], remove_text=True,
187-
tol=0 if platform.machine() == 'x86_64' else 0.01)
189+
tol=0 if platform.machine() == 'x86_64' else 0.03)
188190
def test_alpha_rcparam():
189191
fig, ax = plt.subplots()
190192
ax.plot(range(10), lw=5)
@@ -212,7 +214,7 @@ def test_fancy():
212214

213215

214216
@image_comparison(['framealpha'], remove_text=True,
215-
tol=0 if platform.machine() == 'x86_64' else 0.02)
217+
tol=0 if platform.machine() == 'x86_64' else 0.024)
216218
def test_framealpha():
217219
x = np.linspace(1, 100, 100)
218220
y = x
@@ -523,7 +525,8 @@ def test_figure_legend_outside():
523525
legbb[nn])
524526

525527

526-
@image_comparison(['legend_stackplot.png'])
528+
@image_comparison(['legend_stackplot.png'],
529+
tol=0.031 if platform.machine() == 'arm64' else 0)
527530
def test_legend_stackplot():
528531
"""Test legend for PolyCollection using stackplot."""
529532
# related to #1341, #1943, and PR #3303
@@ -658,8 +661,8 @@ def test_empty_bar_chart_with_legend():
658661
plt.legend()
659662

660663

661-
@image_comparison(['shadow_argument_types.png'], remove_text=True,
662-
style='mpl20')
664+
@image_comparison(['shadow_argument_types.png'], remove_text=True, style='mpl20',
665+
tol=0.028 if platform.machine() == 'arm64' else 0)
663666
def test_shadow_argument_types():
664667
# Test that different arguments for shadow work as expected
665668
fig, ax = plt.subplots()

‎lib/matplotlib/tests/test_lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_lines.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_invalid_line_data():
9898
line.set_ydata(0)
9999

100100

101-
@image_comparison(['line_dashes'], remove_text=True, tol=0.002)
101+
@image_comparison(['line_dashes'], remove_text=True, tol=0.003)
102102
def test_line_dashes():
103103
# Tolerance introduced after reordering of floating-point operations
104104
# Remove when regenerating the images
@@ -139,7 +139,8 @@ def test_valid_linestyles():
139139
line.set_linestyle('aardvark')
140140

141141

142-
@image_comparison(['drawstyle_variants.png'], remove_text=True)
142+
@image_comparison(['drawstyle_variants.png'], remove_text=True,
143+
tol=0.03 if platform.machine() == 'arm64' else 0)
143144
def test_drawstyle_variants():
144145
fig, axs = plt.subplots(6)
145146
dss = ["default", "steps-mid", "steps-pre", "steps-post", "steps", None]

‎lib/matplotlib/tests/test_patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patches.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Tests specific to the patches module.
33
"""
4+
import platform
5+
46
import numpy as np
57
from numpy.testing import assert_almost_equal, assert_array_equal
68
import pytest
@@ -15,9 +17,6 @@
1517
collections as mcollections, colors as mcolors, patches as mpatches,
1618
path as mpath, transforms as mtransforms, rcParams)
1719

18-
import sys
19-
on_win = (sys.platform == 'win32')
20-
2120

2221
def test_Polygon_close():
2322
#: GitHub issue #1018 identified a bug in the Polygon handling
@@ -438,8 +437,8 @@ def test_wedge_movement():
438437
assert getattr(w, attr) == new_v
439438

440439

441-
# png needs tol>=0.06, pdf tol>=1.617
442-
@image_comparison(['wedge_range'], remove_text=True, tol=1.65 if on_win else 0)
440+
@image_comparison(['wedge_range'], remove_text=True,
441+
tol=0.009 if platform.machine() == 'arm64' else 0)
443442
def test_wedge_range():
444443
ax = plt.axes()
445444

@@ -564,7 +563,8 @@ def test_units_rectangle():
564563
ax.set_ylim([5*U.km, 9*U.km])
565564

566565

567-
@image_comparison(['connection_patch.png'], style='mpl20', remove_text=True)
566+
@image_comparison(['connection_patch.png'], style='mpl20', remove_text=True,
567+
tol=0.024 if platform.machine() == 'arm64' else 0)
568568
def test_connection_patch():
569569
fig, (ax1, ax2) = plt.subplots(1, 2)
570570

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.