Patch out the rctemplate tests properly.

This commit is contained in:
Elliott Sales de Andrade 2018-03-31 03:28:44 -04:00
parent 15844872fc
commit b11ac2671c
5 changed files with 72 additions and 10 deletions

View File

@ -1,15 +1,16 @@
From 69c596604b1dee1b8aeb066907a4543053e375a9 Mon Sep 17 00:00:00 2001
From 47e4d5c14793503a7af7919a1fb7aaa04016c9e3 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/3] matplotlibrc path search fix
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/__init__.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
lib/matplotlib/__init__.py | 8 +++++---
lib/matplotlib/tests/test_rcparams.py | 23 ++++++++++++++++-------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
index 93397070f..c68b8ca9a 100644
index 93397070f..98560d9db 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -739,9 +739,12 @@ def _get_data_path():
@ -25,7 +26,17 @@ index 93397070f..c68b8ca9a 100644
# setuptools' namespace_packages may highjack this init file
# so need to try something known to be in matplotlib, not basemap
import matplotlib.afm
@@ -836,7 +839,7 @@ def matplotlib_fname():
@@ -822,8 +825,7 @@ def matplotlib_fname():
- `$HOME/.matplotlib/matplotlibrc` if `$HOME` is defined.
- - Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a
- system-defined copy.
+ - Lastly, it looks in `/etc/matplotlibrc` for a system-defined copy.
"""
def gen_candidates():
@@ -836,7 +838,7 @@ def matplotlib_fname():
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
yield os.path.join(_get_configdir(), 'matplotlibrc')
@ -34,6 +45,54 @@ index 93397070f..c68b8ca9a 100644
for fname in gen_candidates():
if os.path.exists(fname):
diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py
index 4d93a9914..1d2097827 100644
--- a/lib/matplotlib/tests/test_rcparams.py
+++ b/lib/matplotlib/tests/test_rcparams.py
@@ -424,15 +424,25 @@ def test_rcparams_reset_after_fail():
assert mpl.rcParams['text.usetex'] is False
-def test_if_rctemplate_is_up_to_date():
+@pytest.fixture
+def mplrc():
+ # This is the Fedora-specific location ...
+ if 'MATPLOTLIBDATA' in os.environ:
+ # ... in buildroot.
+ return os.path.join(os.environ['MATPLOTLIBDATA'],
+ '../../../../etc/matplotlibrc')
+ else:
+ # ... on installed systems.
+ return '/etc/matplotlibrc'
+
+
+def test_if_rctemplate_is_up_to_date(mplrc):
# This tests if the matplotlibrc.template file
# contains all valid rcParams.
dep1 = mpl._all_deprecated
dep2 = mpl._deprecated_set
deprecated = list(dep1.union(dep2))
- #print(deprecated)
- path_to_rc = mpl.matplotlib_fname()
- with open(path_to_rc, "r") as f:
+ with open(mplrc, "r") as f:
rclines = f.readlines()
missing = {}
for k,v in mpl.defaultParams.items():
@@ -454,11 +464,10 @@ def test_if_rctemplate_is_up_to_date():
.format(missing.items()))
-def test_if_rctemplate_would_be_valid(tmpdir):
+def test_if_rctemplate_would_be_valid(tmpdir, mplrc):
# This tests if the matplotlibrc.template file would result in a valid
# rc file if all lines are uncommented.
- path_to_rc = mpl.matplotlib_fname()
- with open(path_to_rc, "r") as f:
+ with open(mplrc, "r") as f:
rclines = f.readlines()
newlines = []
for line in rclines:
--
2.14.3

View File

@ -1,4 +1,4 @@
From ee4772513109de1c2dadb4d4989eedd2a5f92e51 Mon Sep 17 00:00:00 2001
From 85622c14c75981b832fbf49ee70231f9edb1922b Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 23 Jan 2018 20:27:17 -0500
Subject: [PATCH 2/3] Increase tolerances for non-x86_64 arches.

View File

@ -1,4 +1,4 @@
From 10e4a0fbcab2ad59b95e1391d3285aff07e1f473 Mon Sep 17 00:00:00 2001
From a1975064e7b68e8587904415b2f3c51ff233089d Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 31 Mar 2018 00:15:14 -0400
Subject: [PATCH 3/3] Increase some tolerances for 32-bit systems.

View File

@ -1,4 +1,4 @@
From 0e88d3f2ada26de2dc3362f30064551b9ea2322b Mon Sep 17 00:00:00 2001
From b35bcac297de5fbf24a093c0a0121856ba7a7b41 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 31 Mar 2018 00:33:37 -0400
Subject: [PATCH 3/3] Increase some tolerances for non-x86 arches.

View File

@ -440,19 +440,22 @@ export http_proxy=http://127.0.0.1/
echo "backend : %{backend}" > matplotlibrc
# Full tests are not run because pytest doesn't seem to understand namespace
# packages in PYTHONPATH.
# Skips:
# * test_polycollection_close: imports mpl_toolkits which is broken as noted
# above.
MPLCONFIGDIR=$PWD \
MATPLOTLIBDATA=%{buildroot}%{_datadir}/matplotlib/mpl-data \
PYTHONPATH=%{buildroot}%{python2_sitearch} \
xvfb-run -a -s "-screen 0 640x480x24" \
%{__python2} -m pytest --pyargs matplotlib -ra -n $(getconf _NPROCESSORS_ONLN) \
-m 'not network' -k 'not test_polycollection_close and not test_if_rctemplate'
-m 'not network' -k 'not test_polycollection_close'
MPLCONFIGDIR=$PWD \
MATPLOTLIBDATA=%{buildroot}%{_datadir}/matplotlib/mpl-data \
PYTHONPATH=%{buildroot}%{python3_sitearch} \
xvfb-run -a -s "-screen 0 640x480x24" \
%{__python3} tests.py -ra -n $(getconf _NPROCESSORS_ONLN) \
-m 'not network' -k 'not test_if_rctemplate'
-m 'not network'
%endif # run_tests
%files -n python-matplotlib-data