From b11ac2671cdd62a42a1cf99aaec4de83e49fc6d9 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 31 Mar 2018 03:28:44 -0400 Subject: [PATCH] Patch out the rctemplate tests properly. --- 0001-matplotlibrc-path-search-fix.patch | 69 +++++++++++++++++-- ...ase-tolerances-for-non-x86_64-arches.patch | 2 +- ...e-some-tolerances-for-32-bit-systems.patch | 2 +- ...e-some-tolerances-for-non-x86-arches.patch | 2 +- python-matplotlib.spec | 7 +- 5 files changed, 72 insertions(+), 10 deletions(-) diff --git a/0001-matplotlibrc-path-search-fix.patch b/0001-matplotlibrc-path-search-fix.patch index a11c26c..611bdb7 100644 --- a/0001-matplotlibrc-path-search-fix.patch +++ b/0001-matplotlibrc-path-search-fix.patch @@ -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 Date: Wed, 27 Sep 2017 19:35:59 -0400 Subject: [PATCH 1/3] matplotlibrc path search fix Signed-off-by: Elliott Sales de Andrade --- - 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 diff --git a/0002-Increase-tolerances-for-non-x86_64-arches.patch b/0002-Increase-tolerances-for-non-x86_64-arches.patch index c7b6857..a987e08 100644 --- a/0002-Increase-tolerances-for-non-x86_64-arches.patch +++ b/0002-Increase-tolerances-for-non-x86_64-arches.patch @@ -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 Date: Tue, 23 Jan 2018 20:27:17 -0500 Subject: [PATCH 2/3] Increase tolerances for non-x86_64 arches. diff --git a/0003-Increase-some-tolerances-for-32-bit-systems.patch b/0003-Increase-some-tolerances-for-32-bit-systems.patch index e81469d..276b45a 100644 --- a/0003-Increase-some-tolerances-for-32-bit-systems.patch +++ b/0003-Increase-some-tolerances-for-32-bit-systems.patch @@ -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 Date: Sat, 31 Mar 2018 00:15:14 -0400 Subject: [PATCH 3/3] Increase some tolerances for 32-bit systems. diff --git a/0003-Increase-some-tolerances-for-non-x86-arches.patch b/0003-Increase-some-tolerances-for-non-x86-arches.patch index f3584b0..d14c77c 100644 --- a/0003-Increase-some-tolerances-for-non-x86-arches.patch +++ b/0003-Increase-some-tolerances-for-non-x86-arches.patch @@ -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 Date: Sat, 31 Mar 2018 00:33:37 -0400 Subject: [PATCH 3/3] Increase some tolerances for non-x86 arches. diff --git a/python-matplotlib.spec b/python-matplotlib.spec index 0ff4726..8693246 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -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