8000 TST: Increase tolerance on more arches · matplotlib/matplotlib@f0ec17d · GitHub
[go: up one dir, main page]

Skip to content

Commit f0ec17d

Browse files
committed
TST: Increase tolerance on more arches
Not sure why this didn't hit Fedora when 3.10.0 was initially built, but it is now during the F42 Mass Rebuild. These tests are already covered by `arm64`-specific tolerances (aka Apple Silicon), and while one or two won't need it, I've changed all of these. Additionally, instead of listing every single architecture, just increase the tolerance on non-x86_64. Also, make a few tweaks to existing conditions to make these all consistent.
1 parent 29f3a5c commit f0ec17d

18 files changed

+51
-57
lines changed

lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def draw_arrow(ax, t, r):
1212

1313

1414
@image_comparison(['fancyarrow_test_image'],
15-
tol=0.012 if platform.machine() == 'arm64' else 0)
15+
tol=0 if platform.machine() == 'x86_64' else 0.012)
1616
def test_fancyarrow():
1717
# Added 0 to test division by zero error described in issue 3930
1818
r = [0.4, 0.3, 0.2, 0.1, 0]
@@ -149,7 +149,7 @@ def test_arrow_styles():
149149

150150

151151
@image_comparison(['connection_styles.png'], style='mpl20', remove_text=True,
152-
tol=0.013 if platform.machine() == 'arm64' else 0)
152+
tol=0 if platform.machine() == 'x86_64' else 0.013)
153153
def test_connection_styles():
154154
styles = mpatches.ConnectionStyle.get_styles()
155155

lib/matplotlib/tests/test_axes.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def test_matshow(fig_test, fig_ref):
243243
'formatter_ticker_004',
244244
'formatter_ticker_005',
245245
],
246-
tol=0.031 if platform.machine() == 'arm64' else 0)
246+
tol=0 if platform.machine() == 'x86_64' else 0.031)
247247
def test_formatter_ticker():
248248
import matplotlib.testing.jpl_units as units
249249
units.register()
@@ -444,7 +444,7 @@ def test_twin_logscale(fig_test, fig_ref, twin):
444444

445445

446446
@image_comparison(['twin_autoscale.png'],
447-
tol=0.009 if platform.machine() == 'arm64' else 0)
447+
tol=0 if platform.machine() == 'x86_64' else 0.009)
448448
def test_twinx_axis_scales():
449449
x = np.array([0, 0.5, 1])
450450
y = 0.5 * x
@@ -1218,9 +1218,8 @@ def test_imshow():
12181218
ax.imshow("r", data=data)
12191219

12201220

1221-
@image_comparison(
1222-
['imshow_clip'], style='mpl20',
1223-
tol=1.24 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
1221+
@image_comparison(['imshow_clip'], style='mpl20',
1222+
tol=0 if platform.machine() == 'x86_64' else 1.24)
12241223
def test_imshow_clip():
12251224
# As originally reported by Gellule Xg <gellule.xg@free.fr>
12261225
# use former defaults to match existing baseline image
@@ -1299,7 +1298,7 @@ def test_fill_betweenx_input(y, x1, x2):
12991298

13001299

13011300
@image_comparison(['fill_between_interpolate'], remove_text=True,
1302-
tol=0.012 if platform.machine() == 'arm64' else 0)
1301+
tol=0 if platform.machine() == 'x86_64' else 0.012)
13031302
def test_fill_between_interpolate():
13041303
x = np.arange(0.0, 2, 0.02)
13051304
y1 = np.sin(2*np.pi*x)
@@ -1728,7 +1727,8 @@ def test_pcolorauto(fig_test, fig_ref, snap):
17281727
ax.pcolormesh(x2, y2, Z, snap=snap)
17291728

17301729

1731-
@image_comparison(['canonical'], tol=0.02 if platform.machine() == 'arm64' else 0)
1730+
@image_comparison(['canonical'],
1731+
tol=0 if platform.machine() == 'x86_64' else 0.02)
17321732
def test_canonical():
17331733
fig, ax = plt.subplots()
17341734
ax.plot([1, 2, 3])
@@ -2653,9 +2653,8 @@ def test_contour_hatching():
26532653
extend='both', alpha=0.5)
26542654

26552655

2656-
@image_comparison(
2657-
['contour_colorbar'], style='mpl20',
2658-
tol=0.54 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
2656+
@image_comparison(['contour_colorbar'], style='mpl20',
2657+
tol=0 if platform.machine() == 'x86_64' else 0.54)
26592658
def test_contour_colorbar():
26602659
x, y, z = contour_dat()
26612660

@@ -3233,7 +3232,7 @@ def test_log_scales_invalid():
32333232

32343233

32353234
@image_comparison(['stackplot_test_image', 'stackplot_test_image'],
3236-
tol=0.031 if platform.machine() == 'arm64' else 0)
3235+
tol=0 if platform.machine() == 'x86_64' else 0.031)
32373236
def test_stackplot():
32383237
fig = plt.figure()
32393238
x = np.linspace(0, 10, 10)
@@ -5138,7 +5137,7 @@ def test_marker_styles():
51385137

51395138

51405139
@image_comparison(['rc_markerfill.png'],
5141-
tol=0.037 if platform.machine() == 'arm64' else 0)
5140+
tol=0 if platform.machine() == 'x86_64' else 0.037)
51425141
def test_markers_fillstyle_rcparams():
51435142
fig, ax = plt.subplots()
51445143
x = np.arange(7)
@@ -5721,7 +5720,7 @@ def test_twin_remove(fig_test, fig_ref):
57215720

57225721

57235722
@image_comparison(['twin_spines.png'], remove_text=True,
5724-
tol=0.022 if platform.machine() == 'arm64' else 0)
5723+
tol=0 if platform.machine() == 'x86_64' else 0.022)
57255724
def test_twin_spines():
57265725

57275726
def make_patch_spines_invisible(ax):
@@ -6318,7 +6317,7 @@ def test_pie_hatch_multi(fig_test, fig_ref):
63186317

63196318

63206319
@image_comparison(['set_get_ticklabels.png'],
6321-
tol=0.025 if platform.machine() == 'arm64' else 0)
6320+
tol=0 if platform.machine() == 'x86_64' else 0.025)
63226321
def test_set_get_ticklabels():
63236322
# test issue 2246
63246323
fig, ax = plt.subplots(2)
@@ -6911,7 +6910,7 @@ def test_loglog():
69116910

69126911

69136912
@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20',
6914-
tol=0.029 if platform.machine() == 'arm64' else 0)
6913+
tol=0 if platform.machine() == 'x86_64' else 0.029)
69156914
def test_loglog_nonpos():
69166915
fig, axs = plt.subplots(3, 3)
69176916
x = np.arange(1, 11)
@@ -7880,7 +7879,7 @@ def test_scatter_empty_data():
78807879

78817880

78827881
@image_comparison(['annotate_across_transforms.png'], style='mpl20', remove_text=True,
7883-
tol=0.025 if platform.machine() == 'arm64' else 0)
7882+
tol=0 if platform.machine() == 'x86_64' else 0.025)
78847883
def test_annotate_across_transforms():
78857884
x = np.linspace(0, 10, 200)
78867885
y = np.exp(-x) * np.sin(x)
@@ -7911,7 +7910,7 @@ def inverted(self):
79117910

79127911

79137912
@image_comparison(['secondary_xy.png'], style='mpl20',
7914-
tol=0.027 if platform.machine() == 'arm64' else 0)
7913+
tol=0 if platform.machine() == 'x86_64' else 0.027)
79157914
def test_secondary_xy():
79167915
fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)
79177916

@@ -9174,10 +9173,8 @@ def test_zorder_and_explicit_rasterization():
91749173
fig.savefig(b, format='pdf')
91759174

91769175

9177-
@image_comparison(
9178-
["preset_clip_paths.png"],
9179-
remove_text=True, style="mpl20",
9180-
tol=0.027 if platform.machine() in ("aarch64", "arm64", "ppc64le") else 0)
9176+
@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
9177+
tol=0 if platform.machine() == 'x86_64' else 0.027)
91819178
def test_preset_clip_paths():
91829179
fig, ax = plt.subplots()
91839180

@@ -9511,7 +9508,7 @@ def test_boxplot_orientation(fig_test, fig_ref):
95119508

95129509

95139510
@image_comparison(["use_colorizer_keyword.png"],
9514-
tol=0.05 if platform.machine() == 'arm64' else 0)
9511+
tol=0 if platform.machine() == 'x86_64' else 0.05)
95159512
def test_use_colorizer_keyword():
95169513
# test using the colorizer keyword
95179514
np.random.seed(0)

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_bbox_inches_tight():
4646

4747
@image_comparison(['bbox_inches_tight_suptile_legend'],
4848
savefig_kwarg={'bbox_inches': 'tight'},
49-
tol=0.02 if platform.machine() == 'arm64' else 0)
49+
tol=0 if platform.machine() == 'x86_64' else 0.02)
5050
def test_bbox_inches_tight_suptile_legend():
5151
plt.plot(np.arange(10), label='a straight line')
5252
plt.legend(bbox_to_anchor=(0.9, 1), loc='upper left')

lib/matplotlib/tests/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def test_barb_limits():
391391

392392

393393
@image_comparison(['EllipseCollection_test_image.png'], remove_text=True,
394-
tol=0.021 if platform.machine() == 'arm64' else 0)
394+
tol=0 if platform.machine() == 'x86_64' else 0.021)
395395
def test_EllipseCollection():
396396
# Test basic functionality
397397
fig, ax = plt.subplots()

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def test_constrained_layout9():
198198

199199

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

lib/matplotlib/tests/test_contour.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_contour_label_with_disconnected_segments():
140140

141141

142142
@image_comparison(['contour_manual_colors_and_levels.png'], remove_text=True,
143-
tol=0.018 if platform.machine() == 'arm64' else 0)
143+
tol=0 if platform.machine() == 'x86_64' else 0.018)
144144
def test_given_colors_levels_and_extends():
145145
# Remove this line when this test image is regenerated.
146146
plt.rcParams['pcolormesh.snap'] = False
@@ -416,10 +416,8 @@ def test_contourf_log_extension():
416416
cb = plt.colorbar(c3, ax=ax3)
417417

418418

419-
@image_comparison(
420-
['contour_addlines.png'], remove_text=True, style='mpl20',
421-
tol=0.15 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x')
422-
else 0.03)
419+
@image_comparison(['contour_addlines.png'], remove_text=True, style='mpl20',
420+
tol=0.03 if platform.machine() == 'x86_64' else 0.15)
423421
# tolerance is because image changed minutely when tick finding on
424422
# colorbars was cleaned up...
425423
def test_contour_addlines():

lib/matplotlib/tests/test_figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def test_clf_keyword():
210210

211211

212212
@image_comparison(['figure_today'],
213-
tol=0.015 if platform.machine() == 'arm64' else 0)
213+
tol=0 if platform.machine() == 'x86_64' else 0.015)
214214
def test_figure():
215215
# named figure support
216216
fig = plt.figure('today')

lib/matplotlib/tests/test_legend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_various_labels():
140140

141141

142142
@image_comparison(['legend_labels_first.png'], remove_text=True,
143-
tol=0.013 if platform.machine() == 'arm64' else 0)
143+
tol=0 if platform.machine() == 'x86_64' else 0.013)
144144
def test_labels_first():
145145
# test labels to left of markers
146146
fig, ax = plt.subplots()
@@ -151,7 +151,7 @@ def test_labels_first():
151151

152152

153153
@image_comparison(['legend_multiple_keys.png'], remove_text=True,
154-
tol=0.013 if platform.machine() == 'arm64' else 0)
154+
tol=0 if platform.machine() == 'x86_64' else 0.013)
155155
def test_multiple_keys():
156156
# test legend entries with multiple keys
157157
fig, ax = plt.subplots()
@@ -514,7 +514,7 @@ def test_figure_legend_outside():
514514

515515

516516
@image_comparison(['legend_stackplot.png'],
517-
tol=0.031 if platform.machine() == 'arm64' else 0)
517+
tol=0 if platform.machine() == 'x86_64' else 0.031)
518518
def test_legend_stackplot():
519519
"""Test legend for PolyCollection using stackplot."""
520520
# related to #1341, #1943, and PR #3303
@@ -650,7 +650,7 @@ def test_empty_bar_chart_with_legend():
650650

651651

652652
@image_comparison(['shadow_argument_types.png'], remove_text=True, style='mpl20',
653-
tol=0.028 if platform.machine() == 'arm64' else 0)
653+
tol=0 if platform.machine() == 'x86_64' else 0.028)
654654
def test_shadow_argument_types():
655655
# Test that different arguments for shadow work as expected
656656
fig, ax = plt.subplots()

lib/matplotlib/tests/test_lines.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_valid_linestyles():
140140

141141

142142
@image_comparison(['drawstyle_variants.png'], remove_text=True,
143-
tol=0.03 if platform.machine() == 'arm64' else 0)
143+
tol=0 if platform.machine() == 'x86_64' else 0.03)
144144
def test_drawstyle_variants():
145145
fig, axs = plt.subplots(6)
146146
dss = ["default", "steps-mid", "steps-pre", "steps-post", "steps", None]
@@ -183,9 +183,8 @@ def test_set_drawstyle():
183183
assert len(line.get_path().vertices) == len(x)
184184

185185

186-
@image_comparison(
187-
['line_collection_dashes'], remove_text=True, style='mpl20',
188-
tol=0 if platform.machine() == 'x86_64' else 0.65)
186+
@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20',
187+
tol=0 if platform.machine() == 'x86_64' else 0.65)
189188
def test_set_line_coll_dash_image():
190189
fig, ax = plt.subplots()
191190
np.random.seed(0)

lib/matplotlib/tests/test_patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def test_wedge_movement():
438438

439439

440440
@image_comparison(['wedge_range'], remove_text=True,
441-
tol=0.009 if platform.machine() == 'arm64' else 0)
441+
tol=0 if platform.machine() == 'x86_64' else 0.009)
442442
def test_wedge_range():
443443
ax = plt.axes()
444444

@@ -564,7 +564,7 @@ def test_units_rectangle():
564564

565565

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

lib/matplotlib/tests/test_path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_nonlinear_containment():
151151

152152

153153
@image_comparison(['arrow_contains_point.png'], remove_text=True, style='mpl20',
154-
tol=0.027 if platform.machine() == 'arm64' else 0)
154+
tol=0 if platform.machine() == 'x86_64' else 0.027)
155155
def test_arrow_contains_point():
156156
# fix bug (#8384)
157157
fig, ax = plt.subplots()
@@ -283,7 +283,7 @@ def test_marker_paths_pdf():
283283

284284
@image_comparison(['nan_path'], style='default', remove_text=True,
285285
extensions=['pdf', 'svg', 'eps', 'png'],
286-
tol=0.009 if platform.machine() == 'arm64' else 0)
286+
tol=0 if platform.machine() == 'x86_64' else 0.009)
287287
def test_nan_isolated_points():
288288

289289
y0 = [0, np.nan, 2, np.nan, 4, 5, 6]

lib/matplotlib/tests/test_patheffects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_patheffect1():
3030

3131

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

3636
ax2 = plt.subplot()
@@ -45,7 +45,8 @@ def test_patheffect2():
4545
foreground="w")])
4646

4747

48-
@image_comparison(['patheffect3'], tol=0.019 if platform.machine() == 'arm64' else 0)
48+
@image_comparison(['patheffect3'],
49+
tol=0 if platform.machine() == 'x86_64' else 0.019)
4950
def test_patheffect3():
5051
p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)
5152
p1.set_path_effects([path_effects.SimpleLineShadow(),

lib/matplotlib/tests/test_simplification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_clipping():
2929

3030

3131
@image_comparison(['overflow'], remove_text=True,
32-
tol=0.007 if platform.machine() == 'arm64' else 0)
32+
tol=0 if platform.machine() == 'x86_64' else 0.007)
3333
def test_overflow():
3434
x = np.array([1.0, 2.0, 3.0, 2.0e5])
3535
y = np.arange(len(x))

lib/matplotlib/tests/test_skew.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def test_set_line_coll_dash_image():
146146

147147

148148
@image_comparison(['skew_rects'], remove_text=True,
149-
tol=0.009 if platform.machine() == 'arm64' else 0)
149+
tol=0 if platform.machine() == 'x86_64' else 0.009)
150150
def test_skew_rectangle():
151151

152152
fix, axes = plt.subplots(5, 5, sharex=True, sharey=True, figsize=(8, 8))

lib/matplotlib/tests/test_subplots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_exceptions():
175175

176176

177177
@image_comparison(['subplots_offset_text'],
178-
tol=0.028 if platform.machine() == 'arm64' else 0)
178+
tol=0 if platform.machine() == 'x86_64' else 0.028)
179179
def test_subplots_offsettext():
180180
x = np.arange(0, 1e10, 1e9)
181181
y = np.arange(0, 100, 10)+1e4

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def test_fill_facecolor():
346346
# Update style when regenerating the test image
347347
@image_comparison(['zoomed_axes.png', 'inverted_zoomed_axes.png'],
348348
style=('classic', '_classic_test_patch'),
349-
tol=0.02 if platform.machine() == 'arm64' else 0)
349+
tol=0 if platform.machine() == 'x86_64' else 0.02)
350350
def test_zooming_with_inverted_axes():
351351
fig, ax = plt.subplots()
352352
ax.plot([1, 2, 3], [1, 2, 3])

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 4 additions & 5 deletions
DA38
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,8 @@ def test_bar3d_lightsource():
221221
np.testing.assert_array_max_ulp(color, collection._facecolor3d[1::6], 4)
222222

223223

224-
@mpl3d_image_comparison(
225-
['contour3d.png'], style='mpl20',
226-
tol=0.002 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
224+
@mpl3d_image_comparison(['contour3d.png'], style='mpl20',
225+
tol=0 if platform.machine() == 'x86_64' else 0.002)
227226
def test_contour3d():
228227
plt.rcParams['axes3d.automargin'] = True # Remove when image is regenerated
229228
fig = plt.figure()
@@ -1721,7 +1720,7 @@ def test_errorbar3d_errorevery():
17211720

17221721

17231722
@mpl3d_image_comparison(['errorbar3d.png'], style='mpl20',
1724-
tol=0.02 if platform.machine() == 'arm64' else 0)
1723+
tol=0 if platform.machine() == 'x86_64' else 0.02)
17251724
def test_errorbar3d():
17261725
"""Tests limits, color styling, and legend for 3D errorbars."""
17271726
fig = plt.figure()
@@ -1737,7 +1736,7 @@ def test_errorbar3d():
17371736
ax.legend()
17381737

17391738

1740-
@image_comparison(['stem3d.png'], style='mpl20', tol=0.008)
1739+
@image_comparison(['stem3d.png'], style='mpl20', tol=0.009)
17411740
def test_stem3d():
17421741
plt.rcParams['axes3d.automargin'] = True # Remove when image is regenerated
17431742
fig, axs = plt.subplots(2, 3, figsize=(8, 6),

0 commit comments

Comments
 (0)
0