Support pytest 4
This commit is contained in:
parent
b5e6655ad8
commit
120f1b74da
170
0004-Avoid-triggering-deprecation-warnings-with-pytest-3..patch
Normal file
170
0004-Avoid-triggering-deprecation-warnings-with-pytest-3..patch
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
From eab11b3cac68f863ccab8067e3d8035aaf57cfe5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Antony Lee <anntzer.lee@gmail.com>
|
||||||
|
Date: Tue, 18 Sep 2018 18:46:50 +0200
|
||||||
|
Subject: [PATCH 4/4] Avoid triggering deprecation warnings with pytest 3.8.
|
||||||
|
|
||||||
|
The new API was introduced in pytest3.6 so bump the test dependency
|
||||||
|
accordingly.
|
||||||
|
---
|
||||||
|
doc/devel/contributing.rst | 6 +++---
|
||||||
|
doc/devel/testing.rst | 4 ++--
|
||||||
|
lib/matplotlib/testing/conftest.py | 10 +++++-----
|
||||||
|
lib/matplotlib/testing/decorators.py | 8 ++++++--
|
||||||
|
requirements/testing/travis35.txt | 2 +-
|
||||||
|
requirements/testing/travis_all.txt | 4 +---
|
||||||
|
setupext.py | 2 +-
|
||||||
|
7 files changed, 19 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/devel/contributing.rst b/doc/devel/contributing.rst
|
||||||
|
index b40a46a6f..463e8c947 100644
|
||||||
|
--- a/doc/devel/contributing.rst
|
||||||
|
+++ b/doc/devel/contributing.rst
|
||||||
|
@@ -109,7 +109,7 @@ value.
|
||||||
|
Installing Matplotlib in developer mode
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
-To install Matplotlib (and compile the c-extensions) run the following
|
||||||
|
+To install Matplotlib (and compile the C-extensions) run the following
|
||||||
|
command from the top-level directory ::
|
||||||
|
|
||||||
|
python -mpip install -ve .
|
||||||
|
@@ -147,11 +147,11 @@ environment is set up properly::
|
||||||
|
.. _pytest: http://doc.pytest.org/en/latest/
|
||||||
|
.. _pep8: https://pep8.readthedocs.io/en/latest/
|
||||||
|
.. _Ghostscript: https://www.ghostscript.com/
|
||||||
|
-.. _Inkscape: https://inkscape.org>
|
||||||
|
+.. _Inkscape: https://inkscape.org/
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
- **Additional dependencies for testing**: pytest_ (version 3.4 or later),
|
||||||
|
+ **Additional dependencies for testing**: pytest_ (version 3.6 or later),
|
||||||
|
Ghostscript_, Inkscape_
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst
|
||||||
|
index c3a5eb8f9..6e8c60fc6 100644
|
||||||
|
--- a/doc/devel/testing.rst
|
||||||
|
+++ b/doc/devel/testing.rst
|
||||||
|
@@ -21,11 +21,11 @@ Requirements
|
||||||
|
|
||||||
|
Install the latest version of Matplotlib as documented in
|
||||||
|
:ref:`installing_for_devs` In particular, follow the instructions to use a
|
||||||
|
-local FreeType build
|
||||||
|
+local FreeType build.
|
||||||
|
|
||||||
|
The following software is required to run the tests:
|
||||||
|
|
||||||
|
-- pytest_ (>=3.4)
|
||||||
|
+- pytest_ (>=3.6)
|
||||||
|
- Ghostscript_ (>= 9.0, to render PDF files)
|
||||||
|
- Inkscape_ (to render SVG files)
|
||||||
|
|
||||||
|
diff --git a/lib/matplotlib/testing/conftest.py b/lib/matplotlib/testing/conftest.py
|
||||||
|
index 96528c8de..8cb90e083 100644
|
||||||
|
--- a/lib/matplotlib/testing/conftest.py
|
||||||
|
+++ b/lib/matplotlib/testing/conftest.py
|
||||||
|
@@ -24,19 +24,19 @@ def mpl_test_settings(request):
|
||||||
|
with _cleanup_cm():
|
||||||
|
|
||||||
|
backend = None
|
||||||
|
- backend_marker = request.keywords.get('backend')
|
||||||
|
+ backend_marker = request.node.get_closest_marker('backend')
|
||||||
|
if backend_marker is not None:
|
||||||
|
assert len(backend_marker.args) == 1, \
|
||||||
|
"Marker 'backend' must specify 1 backend."
|
||||||
|
- backend = backend_marker.args[0]
|
||||||
|
+ backend, = backend_marker.args
|
||||||
|
prev_backend = matplotlib.get_backend()
|
||||||
|
|
||||||
|
style = '_classic_test' # Default of cleanup and image_comparison too.
|
||||||
|
- style_marker = request.keywords.get('style')
|
||||||
|
+ style_marker = request.node.get_closest_marker('style')
|
||||||
|
if style_marker is not None:
|
||||||
|
assert len(style_marker.args) == 1, \
|
||||||
|
"Marker 'style' must specify 1 style."
|
||||||
|
- style = style_marker.args[0]
|
||||||
|
+ style, = style_marker.args
|
||||||
|
|
||||||
|
matplotlib.testing.setup()
|
||||||
|
if backend is not None:
|
||||||
|
@@ -73,7 +73,7 @@ def mpl_image_comparison_parameters(request, extension):
|
||||||
|
# pytest won't get confused.
|
||||||
|
# We annotate the decorated function with any parameters captured by this
|
||||||
|
# fixture so that they can be used by the wrapper in image_comparison.
|
||||||
|
- baseline_images = request.keywords['baseline_images'].args[0]
|
||||||
|
+ baseline_images, = request.node.get_closest_marker('baseline_images').args
|
||||||
|
if baseline_images is None:
|
||||||
|
# Allow baseline image list to be produced on the fly based on current
|
||||||
|
# parametrization.
|
||||||
|
diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py
|
||||||
|
index f3fc47c68..c1bb1fdc2 100644
|
||||||
|
--- a/lib/matplotlib/testing/decorators.py
|
||||||
|
+++ b/lib/matplotlib/testing/decorators.py
|
||||||
|
@@ -215,8 +215,12 @@ class _ImageComparisonBase(object):
|
||||||
|
if self.remove_text:
|
||||||
|
remove_ticks_and_titles(fig)
|
||||||
|
|
||||||
|
+ ext = extension.args[0] if hasattr(extension, 'args') else extension
|
||||||
|
+ # XXX this is needed twice for test_mixedsubplots[extension2]
|
||||||
|
+ ext = ext.args[0] if hasattr(ext, 'args') else ext
|
||||||
|
+
|
||||||
|
actual_fname = (
|
||||||
|
- os.path.join(self.result_dir, baseline) + '.' + extension)
|
||||||
|
+ os.path.join(self.result_dir, baseline) + '.' + ext)
|
||||||
|
kwargs = self.savefig_kwargs.copy()
|
||||||
|
if extension == 'pdf':
|
||||||
|
kwargs.setdefault('metadata',
|
||||||
|
@@ -224,7 +228,7 @@ class _ImageComparisonBase(object):
|
||||||
|
'CreationDate': None})
|
||||||
|
fig.savefig(actual_fname, **kwargs)
|
||||||
|
|
||||||
|
- expected_fname = self.copy_baseline(baseline, extension)
|
||||||
|
+ expected_fname = self.copy_baseline(baseline, ext)
|
||||||
|
_raise_on_image_difference(expected_fname, actual_fname, self.tol)
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/requirements/testing/travis35.txt b/requirements/testing/travis35.txt
|
||||||
|
index fc3c3428b..f137d3bbb 100644
|
||||||
|
--- a/requirements/testing/travis35.txt
|
||||||
|
+++ b/requirements/testing/travis35.txt
|
||||||
|
@@ -5,7 +5,7 @@ python-dateutil==2.1
|
||||||
|
numpy==1.10.0
|
||||||
|
pandas<0.21.0
|
||||||
|
pyparsing==2.0.1
|
||||||
|
-pytest==3.4
|
||||||
|
+pytest==3.6
|
||||||
|
pytest-cov==2.3.1
|
||||||
|
pytest-timeout==1.2.1 # Newer pytest-timeouts don't support pytest 3.4.
|
||||||
|
pytest-rerunfailures<5 # newer versions require pytest3.6
|
||||||
|
diff --git a/requirements/testing/travis_all.txt b/requirements/testing/travis_all.txt
|
||||||
|
index dcffd281e..3f5811b1b 100644
|
||||||
|
--- a/requirements/testing/travis_all.txt
|
||||||
|
+++ b/requirements/testing/travis_all.txt
|
||||||
|
@@ -6,9 +6,7 @@ cycler
|
||||||
|
numpy
|
||||||
|
pillow
|
||||||
|
pyparsing
|
||||||
|
-# pytest-timeout master depends on pytest>=3.6. Testing with pytest 3.4 is
|
||||||
|
-# still supported; this is tested by the first travis python 3.5 build
|
||||||
|
-pytest>=3.6,<4
|
||||||
|
+pytest
|
||||||
|
pytest-cov
|
||||||
|
pytest-faulthandler
|
||||||
|
pytest-rerunfailures
|
||||||
|
diff --git a/setupext.py b/setupext.py
|
||||||
|
index fc82d5d15..186217648 100644
|
||||||
|
--- a/setupext.py
|
||||||
|
+++ b/setupext.py
|
||||||
|
@@ -821,7 +821,7 @@ class Toolkits(OptionalPackage):
|
||||||
|
|
||||||
|
class Tests(OptionalPackage):
|
||||||
|
name = "tests"
|
||||||
|
- pytest_min_version = '3.4'
|
||||||
|
+ pytest_min_version = '3.6'
|
||||||
|
default_config = False
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -60,8 +60,8 @@ Patch0001: 0001-Force-using-system-qhull.patch
|
|||||||
Patch0002: 0001-Use-packaged-jquery-and-jquery-ui.patch
|
Patch0002: 0001-Use-packaged-jquery-and-jquery-ui.patch
|
||||||
|
|
||||||
# Fedora-specific patches; see:
|
# Fedora-specific patches; see:
|
||||||
# https://github.com/QuLogic/matplotlib/tree/fedora-patches
|
# https://github.com/fedora-python/matplotlib/tree/fedora-patches
|
||||||
# https://github.com/QuLogic/matplotlib/tree/fedora-patches-non-x86
|
# https://github.com/fedora-python/matplotlib/tree/fedora-patches-non-x86
|
||||||
# Updated test images for new FreeType.
|
# Updated test images for new FreeType.
|
||||||
Source1000: https://github.com/QuLogic/mpl-images/archive/v%{mpl_images_version}-with-freetype-%{ftver}/matplotlib-%{mpl_images_version}-with-freetype-%{ftver}.tar.gz
|
Source1000: https://github.com/QuLogic/mpl-images/archive/v%{mpl_images_version}-with-freetype-%{ftver}/matplotlib-%{mpl_images_version}-with-freetype-%{ftver}.tar.gz
|
||||||
# Search in /etc/matplotlibrc:
|
# Search in /etc/matplotlibrc:
|
||||||
@ -72,6 +72,8 @@ Patch1002: 0002-Increase-tolerances-for-non-x86_64-arches.patch
|
|||||||
Patch1003: 0003-Increase-some-tolerances-for-32-bit-systems.patch
|
Patch1003: 0003-Increase-some-tolerances-for-32-bit-systems.patch
|
||||||
# Image tolerances for 64-bit (but not x86_64) systems: aarch64 ppc64(le) s390x
|
# Image tolerances for 64-bit (but not x86_64) systems: aarch64 ppc64(le) s390x
|
||||||
Patch1004: 0003-Increase-some-tolerances-for-non-x86-arches.patch
|
Patch1004: 0003-Increase-some-tolerances-for-non-x86-arches.patch
|
||||||
|
# Support pytest 4 (from a3b9ef7c7c8750ff65d9341fb20811b2c4c99a73)
|
||||||
|
Patch1005: 0004-Avoid-triggering-deprecation-warnings-with-pytest-3..patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -270,6 +272,8 @@ gzip -dc %SOURCE1000 | tar xvf - --transform='s~^mpl-images-%{mpl_images_version
|
|||||||
%endif
|
%endif
|
||||||
rm -r extern/libqhull
|
rm -r extern/libqhull
|
||||||
|
|
||||||
|
%patch1005 -p1
|
||||||
|
|
||||||
# Copy setup.cfg to the builddir
|
# Copy setup.cfg to the builddir
|
||||||
cp -p %{SOURCE1} setup.cfg
|
cp -p %{SOURCE1} setup.cfg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user