From 0939c27b1d47cabd19c09fc09f15ef4fb18331b4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 24 Aug 2021 04:47:50 -0400 Subject: [PATCH 3/4] Increase a few test tolerances on some arches. Signed-off-by: Elliott Sales de Andrade --- lib/matplotlib/tests/test_axes.py | 6 ++++-- lib/matplotlib/tests/test_backend_pgf.py | 2 +- 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_mathtext.py | 7 +++++-- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index c8604b8657..da72bb9415 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1031,7 +1031,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 # use former defaults to match existing baseline image @@ -2340,7 +2341,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_backend_pgf.py b/lib/matplotlib/tests/test_backend_pgf.py index 482bc073a7..ab16d9736c 100644 --- a/lib/matplotlib/tests/test_backend_pgf.py +++ b/lib/matplotlib/tests/test_backend_pgf.py @@ -169,7 +169,7 @@ def test_pathclip(): # test mixed mode rendering @needs_pgf_xelatex @pytest.mark.backend('pgf') -@image_comparison(['pgf_mixedmode.pdf'], style='default') +@image_comparison(['pgf_mixedmode.pdf'], style='default', tol=0.9) def test_mixedmode(): mpl.rcParams.update({'font.family': 'serif', 'pgf.rcfonts': False}) Y, X = np.ogrid[-1:1:40j, -1:1:40j] diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py index 4336b761f6..7d3927408b 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 @@ -233,7 +235,8 @@ def test_colorbar_single_ax_panchor_east(constrained): assert ax.get_anchor() == 'E' -@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 8bf77f0d54..82c0b09ac3 100644 --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -319,7 +319,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 46dbe4cfe8..268473c6c0 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1322,8 +1322,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 e7002df8a5..8738fd94a0 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 @@ -165,7 +166,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_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index 7f8b06fa0e..d7d5e687fe 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -1,5 +1,6 @@ import io from pathlib import Path +import platform import re import shlex from xml.etree import ElementTree as ET @@ -198,7 +199,8 @@ def baseline_images(request, fontset, index, text): @pytest.mark.parametrize( 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif']) @pytest.mark.parametrize('baseline_images', ['mathtext'], indirect=True) -@image_comparison(baseline_images=None) +@image_comparison(baseline_images=None, + tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0) def test_mathtext_rendering(baseline_images, fontset, index, text): mpl.rcParams['mathtext.fontset'] = fontset fig = plt.figure(figsize=(5.25, 0.75)) @@ -239,7 +241,8 @@ def test_mathtext_rendering_lightweight(baseline_images, fontset, index, text): @pytest.mark.parametrize( 'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif']) @pytest.mark.parametrize('baseline_images', ['mathfont'], indirect=True) -@image_comparison(baseline_images=None, extensions=['png']) +@image_comparison(baseline_images=None, extensions=['png'], + tol=0.011 if platform.machine() in ('ppc64le', 's390x') else 0) def test_mathfont_rendering(baseline_images, fontset, index, text): mpl.rcParams['mathtext.fontset'] = fontset fig = plt.figure(figsize=(5.25, 0.75)) -- 2.36.1