Make a test more robust.

This commit is contained in:
Elliott Sales de Andrade 2021-08-10 01:34:04 -04:00
parent 97a48b2aed
commit c9814b3833
8 changed files with 51 additions and 6 deletions

View File

@ -1,7 +1,7 @@
From 6277ea0c008b02cd2abe017d041b43a35a407c6c Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 27 Sep 2017 19:35:59 -0400
Subject: [PATCH 1/6] matplotlibrc path search fix
Subject: [PATCH 1/7] matplotlibrc path search fix
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---

View File

@ -1,7 +1,7 @@
From 322fe366ece11ae948c7f6ba0191f7dbc5db444b Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 14 Feb 2020 06:05:42 -0500
Subject: [PATCH 2/6] Set FreeType version to 2.11.0 and update tolerances.
Subject: [PATCH 2/7] Set FreeType version to 2.11.0 and update tolerances.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---

View File

@ -1,7 +1,7 @@
From d807e4e108073ee0fbda02340b206bf3766d9c7c Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 4 Jun 2021 02:32:31 -0400
Subject: [PATCH 3/6] Slightly increase tolerance on rcupdate test.
Subject: [PATCH 3/7] Slightly increase tolerance on rcupdate test.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---

View File

@ -1,7 +1,7 @@
From ea96e5684af98e28e704dc26f12b793c6032ada6 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Fri, 4 Jun 2021 03:20:38 -0400
Subject: [PATCH 4/6] Use new style for test_text_urls_tex.
Subject: [PATCH 4/7] Use new style for test_text_urls_tex.
This test does not depend on the font style, just that the annotation
appears over it. Switching to mpl20 style stops using Helvetica, and

View File

@ -1,7 +1,7 @@
From 982f5255e5da9c5023ca9997aff78c86eb0e8000 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Thu, 24 Jun 2021 01:45:04 -0400
Subject: [PATCH 5/6] Backport PR #20488: FIX: Include 0 when checking lognorm
Subject: [PATCH 5/7] Backport PR #20488: FIX: Include 0 when checking lognorm
vmin
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>

View File

@ -1,7 +1,7 @@
From 28753e5db82bba5898ee302d687d201ae2a96cd6 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 9 Aug 2021 21:38:15 -0400
Subject: [PATCH 6/6] Increase mathfont test tolerance on some systems.
Subject: [PATCH 6/7] Increase mathfont test tolerance on some systems.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---

View File

@ -0,0 +1,42 @@
From 227aacf576f6fce253673ce05365db11dfa6df7d Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 10 Aug 2021 00:45:07 -0400
Subject: [PATCH 7/7] Make test_change_epoch more robust.
The epoch is set by explicitly calling `mdates.set_epoch`, or implicitly
set to the default by `mdates.get_epoch` (which is also called when
converting datetimes.)
However, when running tests in parallel, there is no guarantee that any
other call to `[gs]et_epoch` might have been made to lock it in, so we
need to do that explicitly.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/tests/test_dates.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/matplotlib/tests/test_dates.py b/lib/matplotlib/tests/test_dates.py
index 8c821c0da5..36449e44aa 100644
--- a/lib/matplotlib/tests/test_dates.py
+++ b/lib/matplotlib/tests/test_dates.py
@@ -1004,12 +1004,15 @@ def test_datetime64_in_list():
def test_change_epoch():
date = np.datetime64('2000-01-01')
+ # use private method to clear the epoch and allow it to be set...
+ mdates._reset_epoch_test_example()
+ mdates.get_epoch() # Set default.
+
with pytest.raises(RuntimeError):
# this should fail here because there is a sentinel on the epoch
# if the epoch has been used then it cannot be set.
mdates.set_epoch('0000-01-01')
- # use private method to clear the epoch and allow it to be set...
mdates._reset_epoch_test_example()
mdates.set_epoch('1970-01-01')
dt = (date - np.datetime64('1970-01-01')).astype('datetime64[D]')
--
2.31.1

View File

@ -73,6 +73,8 @@ Patch1004: 0004-Use-new-style-for-test_text_urls_tex.patch
Patch1005: 0005-Backport-PR-20488-FIX-Include-0-when-checking-lognor.patch
# Tweak tolerances a bit.
Patch1006: 0006-Increase-mathfont-test-tolerance-on-some-systems.patch
# https://github.com/matplotlib/matplotlib/pull/20817
Patch1007: 0007-Make-test_change_epoch-more-robust.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -332,6 +334,7 @@ cp -p %{SOURCE1} setup.cfg
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%build