python-matplotlib/0004-Increase-a-few-test-tolerances-on-some-arches.patch
2021-12-14 04:53:06 -05:00

128 lines
5.0 KiB
Diff

From 715490fce1f7a2579f620802bbf25d525b5f2e7c 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 4/4] 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 98878513b5..890f1de85d 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -890,7 +890,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
@@ -2083,7 +2084,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 0fd049655a..65dbb6410e 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
@@ -186,7 +188,8 @@ def test_colorbar_positioning(use_gridspec):
anchor=(0.8, 0.5), shrink=0.6, use_gridspec=use_gridspec)
-@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 5d887416a4..c0a652f5d5 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 c846ecfdcb..c04b086784 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.31.1