8000 Merge pull request #29557 from tacaswell/auto-backport-of-pr-29518-on… · matplotlib/matplotlib@f83e8b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f83e8b1

Browse files
authored
Merge pull request #29557 from tacaswell/auto-backport-of-pr-29518-on-v3.10.x
Backport PR #29518: TST: Increase tolerance on more arches
2 parents b17774c + a04d114 commit f83e8b1

18 files changed

+50
-54
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: 18 additions & 19 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)
@@ -1727,7 +1726,8 @@ def test_pcolorauto(fig_test, fig_ref, snap):
17271726
ax.pcolormesh(x2, y2, Z, snap=snap)
17281727

17291728

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

26542654

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

@@ -3232,7 +3231,7 @@ def test_log_scales_invalid():
32323231

32333232

32343233
@image_comparison(['stackplot_test_image', 'stackplot_test_image'],
3235-
tol=0.031 if platform.machine() == 'arm64' else 0)
3234+
tol=0 if platform.machine() == 'x86_64' else 0.031)
32363235
def test_stackplot():
32373236
fig = plt.figure()
32383237
x = np.linspace(0, 10, 10)
@@ -5126,7 +5125,7 @@ def test_marker_styles():
51265125

51275126

51285127
@image_comparison(['rc_markerfill.png'],
5129-
tol=0.037 if platform.machine() == 'arm64' else 0)
5128+
tol=0 if platform.machine() == 'x86_64' else 0.037)
51305129
def test_markers_fillstyle_rcparams():
51315130
fig, ax = plt.subplots()
51325131
x = np.arange(7)
@@ -5709,7 +5708,7 @@ def test_twin_remove(fig_test, fig_ref):
57095708

57105709

57115710
@image_comparison(['twin_spines.png'], remove_text=True,
5712-
tol=0.022 if platform.machine() == 'arm64' else 0)
5711+
tol=0 if platform.machine() == 'x86_64' else 0.022)
57135712
def test_twin_spines():
57145713

57155714
def make_patch_spines_invisible(ax):
@@ -6306,7 +6305,7 @@ def test_pie_hatch_multi(fig_test, fig_ref):
63066305

63076306

63086307
@image_comparison(['set_get_ticklabels.png'],
6309-
tol=0.025 if platform.machine() == 'arm64' else 0)
6308+
tol=0 if platform.machine() == 'x86_64' else 0.025)
63106309
def test_set_get_ticklabels():
63116310
# test issue 2246
63126311
fig, ax = plt.subplots(2)
@@ -6899,7 +6898,7 @@ def test_loglog():
68996898

69006899

69016900
@image_comparison(["test_loglog_nonpos.png"], remove_text=True, style='mpl20',
6902-
tol=0.029 if platform.machine() == 'arm64' else 0)
6901+
tol=0 if platform.machine() == 'x86_64' else 0.029)
69036902
def test_loglog_nonpos():
69046903
fig, axs = plt.subplots(3, 3)
69056904
x = np.arange(1, 11)
@@ -7839,7 +7838,7 @@ def test_scatter_empty_data():
78397838

78407839

78417840
@image_comparison(['annotate_across_transforms.png'], style='mpl20', remove_text=True,
7842-
tol=0.025 if platform.machine() == 'arm64' else 0)
7841+
tol=0 if platform.machine() == 'x86_64' else 0.025)
78437842
def test_annotate_across_transforms():
78447843
x = np.linspace(0, 10, 200)
78457844
y = np.exp(-x) * np.sin(x)
@@ -7870,7 +7869,7 @@ def inverted(self):
78707869

78717870

78727871
@image_comparison(['secondary_xy.png'], style='mpl20',
7873-
tol=0.027 if platform.machine() == 'arm64' else 0)
7872+
tol=0 if platform.machine() == 'x86_64' else 0.027)
78747873
def test_secondary_xy():
78757874
fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)
78767875

@@ -9134,7 +9133,7 @@ def test_zorder_and_explicit_rasterization():
91349133

91359134

91369135
@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
9137-
tol=0.027 if platform.machine() in ("arm64", "ppc64le") else 0)
9136+
tol=0 if platf 10000 orm.machine() == 'x86_64' else 0.027)
91389137
def test_preset_clip_paths():
91399138
fig, ax = plt.subplots()
91409139

@@ -9467,7 +9466,7 @@ def test_boxplot_orientation(fig_test, fig_ref):
94679466

94689467

94699468
@image_comparison(["use_colorizer_keyword.png"],
9470-
tol=0.05 if platform.machine() == 'arm64' else 0)
9469+
tol=0 if platform.machine() == 'x86_64' else 0.05)
94719470
def test_use_colorizer_keyword():
94729471
# test using the colorizer keyword
94739472
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
@@ -45,7 +45,7 @@ def test_bbox_inches_tight():
4545

4646
@image_comparison(['bbox_inches_tight_suptile_legend'],
4747
savefig_kwarg={'bbox_inches': 'tight'},
48-
tol=0.02 if platform.machine() == 'arm64' else 0)
48+
tol=0 if platform.machine() == 'x86_64' else 0.02)
4949
def test_bbox_inches_tight_suptile_legend():
5050
plt.plot(np.arange(10), label='a straight line')
5151
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
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()
@@ -1713,7 +1712,7 @@ def test_errorbar3d_errorevery():
17131712

17141713

17151714
@mpl3d_image_comparison(['errorbar3d.png'], style='mpl20',
1716-
tol=0.02 if platform.machine() == 'arm64' else 0)
1715+
tol=0 if platform.machine() == 'x86_64' else 0.02)
17171716
def test_errorbar3d():
17181717
"""Tests limits, color styling, and legend for 3D errorbars."""
17191718
fig = plt.figure()
@@ -1729,7 +1728,7 @@ def test_errorbar3d():
17291728
ax.legend()
17301729

17311730

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

0 commit comments

Comments
 (0)
0