Fix a flaky test.
This commit is contained in:
parent
e6f3591340
commit
ea129e4586
39
16656.patch
Normal file
39
16656.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 957abbb637931558a2785941981c05401c2050d7 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 4 Mar 2020 00:00:56 -0500
|
||||
Subject: [PATCH] Make test_imagegrid_cbar_mode_edge less flaky.
|
||||
|
||||
Since parametrizing the test allows it to run in parallel, this makes it
|
||||
flaky, as one process can overwrite the test result image of another.
|
||||
|
||||
Our standard way for dealing with tests that use the same baseline image
|
||||
is to pass duplicate filenames to `image_comparison`, because that is
|
||||
serialized.
|
||||
---
|
||||
lib/mpl_toolkits/tests/test_axes_grid.py | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/mpl_toolkits/tests/test_axes_grid.py b/lib/mpl_toolkits/tests/test_axes_grid.py
|
||||
index 58358b68665..6c88ba9794e 100644
|
||||
--- a/lib/mpl_toolkits/tests/test_axes_grid.py
|
||||
+++ b/lib/mpl_toolkits/tests/test_axes_grid.py
|
||||
@@ -12,10 +12,16 @@
|
||||
# The original version of this test relied on mpl_toolkits's slightly different
|
||||
# colorbar implementation; moving to matplotlib's own colorbar implementation
|
||||
# caused the small image comparison error.
|
||||
-@pytest.mark.parametrize("legacy_colorbar", [False, True])
|
||||
-@image_comparison(['imagegrid_cbar_mode.png'],
|
||||
+@image_comparison(['imagegrid_cbar_mode.png'] * 2,
|
||||
remove_text=True, style='mpl20', tol=0.3)
|
||||
-def test_imagegrid_cbar_mode_edge(legacy_colorbar):
|
||||
+def test_imagegrid_cbar_mode_edge():
|
||||
+ # Note, we don't use @pytest.mark.parametrize, because in parallel this
|
||||
+ # might cause one process result to overwrite another's.
|
||||
+ for legacy_colorbar in [False, True]:
|
||||
+ _test_imagegrid_cbar_mode_edge(legacy_colorbar)
|
||||
+
|
||||
+
|
||||
+def _test_imagegrid_cbar_mode_edge(legacy_colorbar):
|
||||
mpl.rcParams["mpl_toolkits.legacy_colorbar"] = legacy_colorbar
|
||||
|
||||
X, Y = np.meshgrid(np.linspace(0, 6, 30), np.linspace(0, 6, 30))
|
@ -59,6 +59,10 @@ Patch0001: 0001-Force-using-system-qhull.patch
|
||||
# Don't attempt to download jQuery and jQuery UI
|
||||
Patch0002: 0001-Use-packaged-jquery-and-jquery-ui.patch
|
||||
|
||||
# Fix a flaky test
|
||||
# https://github.com/matplotlib/matplotlib/pull/16656
|
||||
Patch0003: https://github.com/matplotlib/matplotlib/pull/16656.patch
|
||||
|
||||
# Fedora-specific patches; see:
|
||||
# https://github.com/fedora-python/matplotlib/tree/fedora-patches
|
||||
# https://github.com/fedora-python/matplotlib/tree/fedora-patches-non-x86
|
||||
@ -260,6 +264,8 @@ Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
|
||||
|
||||
%patch0002 -p1
|
||||
|
||||
%patch0003 -p1
|
||||
|
||||
# Fedora-specific patches follow:
|
||||
%patch1001 -p1
|
||||
# Updated test images for new FreeType.
|
||||
|
Loading…
Reference in New Issue
Block a user