python-matplotlib/0003-Increase-a-few-test-tolerances-on-some-arches.patch
Elliott Sales de Andrade f97a7a2b07 Update to 3.5.2 (#2081232)
2022-05-04 19:14:19 -04:00

128 lines
4.9 KiB
Diff

From eec799b589e203bfadaed0edb67e1719b843f0fd Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 24 Aug 2021 04:47:50 -0400
Subject: [PATCH 3/3] Increase a few test tolerances on some arches.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/tests/test_axes.py | 6 ++++--
lib/matplotlib/tests/test_colorbar.py | 5 ++++-
lib/matplotlib/tests/test_contour.py | 3 ++-
lib/matplotlib/tests/test_image.py | 4 ++--
lib/matplotlib/tests/test_lines.py | 4 +++-
lib/matplotlib/tests/test_streamplot.py | 3 ++-
6 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index 03b92d34fa..0149a5d01a 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -918,7 +918,8 @@ def test_imshow():
ax.imshow("r", data=data)
-@image_comparison(['imshow_clip'], style='mpl20')
+@image_comparison(['imshow_clip'], style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 1.24)
def test_imshow_clip():
# As originally reported by Gellule Xg <gellule.xg@free.fr>
# use former defaults to match existing baseline image
@@ -2127,7 +2128,8 @@ def test_contour_hatching():
extend='both', alpha=0.5)
-@image_comparison(['contour_colorbar'], style='mpl20')
+@image_comparison(['contour_colorbar'], style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 0.02)
def test_contour_colorbar():
x, y, z = contour_dat()
diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py
index 304056f6d1..083c595f6b 100644
--- a/lib/matplotlib/tests/test_colorbar.py
+++ b/lib/matplotlib/tests/test_colorbar.py
@@ -1,3 +1,5 @@
+import platform
+
import numpy as np
import pytest
@@ -218,7 +220,8 @@ def test_colorbar_single_ax_panchor_false():
plt.colorbar(panchor=False)
-@image_comparison(['contour_colorbar.png'], remove_text=True)
+@image_comparison(['contour_colorbar.png'], remove_text=True,
+ tol=0 if platform.machine() == 'x86_64' else 0.01)
def test_contour_colorbar():
fig, ax = plt.subplots(figsize=(4, 2))
data = np.arange(1200).reshape(30, 40) - 500
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py
index 10fb011166..40f60de022 100644
--- a/lib/matplotlib/tests/test_contour.py
+++ b/lib/matplotlib/tests/test_contour.py
@@ -345,7 +345,8 @@ def test_contourf_log_extension():
@image_comparison(['contour_addlines.png'],
- remove_text=True, style='mpl20', tol=0.03)
+ remove_text=True, style='mpl20',
+ tol=0.03 if platform.machine() == 'x86_64' else 0.15)
# tolerance is because image changed minutely when tick finding on
# colorbars was cleaned up...
def test_contour_addlines():
diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
index 719b190578..860a2444df 100644
--- a/lib/matplotlib/tests/test_image.py
+++ b/lib/matplotlib/tests/test_image.py
@@ -1323,8 +1323,8 @@ def test_nonuniform_and_pcolor():
ax.set(xlim=(0, 10))
-@image_comparison(["rgba_antialias.png"], style="mpl20",
- remove_text=True)
+@image_comparison(["rgba_antialias.png"], style="mpl20", remove_text=True,
+ tol=0 if platform.machine() == 'x86_64' else 0.007)
def test_rgba_antialias():
fig, axs = plt.subplots(2, 2, figsize=(3.5, 3.5), sharex=False,
sharey=False, constrained_layout=True)
diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py
index f6917a134b..a7b5772e8c 100644
--- a/lib/matplotlib/tests/test_lines.py
+++ b/lib/matplotlib/tests/test_lines.py
@@ -3,6 +3,7 @@ Tests specific to the lines module.
"""
import itertools
+import platform
import timeit
from types import SimpleNamespace
@@ -162,7 +163,8 @@ def test_set_drawstyle():
assert len(line.get_path().vertices) == len(x)
-@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20')
+@image_comparison(['line_collection_dashes'], remove_text=True, style='mpl20',
+ tol=0 if platform.machine() == 'x86_64' else 0.62)
def test_set_line_coll_dash_image():
fig, ax = plt.subplots()
np.random.seed(0)
diff --git a/lib/matplotlib/tests/test_streamplot.py b/lib/matplotlib/tests/test_streamplot.py
index c8824feb06..879d43f28b 100644
--- a/lib/matplotlib/tests/test_streamplot.py
+++ b/lib/matplotlib/tests/test_streamplot.py
@@ -34,7 +34,8 @@ def test_startpoints():
plt.plot(start_x, start_y, 'ok')
-@image_comparison(['streamplot_colormap'], remove_text=True, style='mpl20')
+@image_comparison(['streamplot_colormap'], remove_text=True, style='mpl20',
+ tol=0.01)
def test_colormap():
X, Y, U, V = velocity_field()
plt.streamplot(X, Y, U, V, color=U, density=0.6, linewidth=2,
--
2.35.1