|
|
120f1b7 |
From eab11b3cac68f863ccab8067e3d8035aaf57cfe5 Mon Sep 17 00:00:00 2001
|
|
|
120f1b7 |
From: Antony Lee <anntzer.lee@gmail.com>
|
|
|
120f1b7 |
Date: Tue, 18 Sep 2018 18:46:50 +0200
|
|
|
120f1b7 |
Subject: [PATCH 4/4] Avoid triggering deprecation warnings with pytest 3.8.
|
|
|
120f1b7 |
|
|
|
120f1b7 |
The new API was introduced in pytest3.6 so bump the test dependency
|
|
|
120f1b7 |
accordingly.
|
|
|
120f1b7 |
---
|
|
|
120f1b7 |
doc/devel/contributing.rst | 6 +++---
|
|
|
120f1b7 |
doc/devel/testing.rst | 4 ++--
|
|
|
120f1b7 |
lib/matplotlib/testing/conftest.py | 10 +++++-----
|
|
|
120f1b7 |
lib/matplotlib/testing/decorators.py | 8 ++++++--
|
|
|
120f1b7 |
requirements/testing/travis35.txt | 2 +-
|
|
|
120f1b7 |
requirements/testing/travis_all.txt | 4 +---
|
|
|
120f1b7 |
setupext.py | 2 +-
|
|
|
120f1b7 |
7 files changed, 19 insertions(+), 17 deletions(-)
|
|
|
120f1b7 |
|
|
|
120f1b7 |
diff --git a/doc/devel/contributing.rst b/doc/devel/contributing.rst
|
|
|
120f1b7 |
index b40a46a6f..463e8c947 100644
|
|
|
120f1b7 |
--- a/doc/devel/contributing.rst
|
|
|
120f1b7 |
+++ b/doc/devel/contributing.rst
|
|
|
120f1b7 |
@@ -109,7 +109,7 @@ value.
|
|
|
120f1b7 |
Installing Matplotlib in developer mode
|
|
|
120f1b7 |
---------------------------------------
|
|
|
120f1b7 |
|
|
|
120f1b7 |
-To install Matplotlib (and compile the c-extensions) run the following
|
|
|
120f1b7 |
+To install Matplotlib (and compile the C-extensions) run the following
|
|
|
120f1b7 |
command from the top-level directory ::
|
|
|
120f1b7 |
|
|
|
120f1b7 |
python -mpip install -ve .
|
|
|
120f1b7 |
@@ -147,11 +147,11 @@ environment is set up properly::
|
|
|
120f1b7 |
.. _pytest: http://doc.pytest.org/en/latest/
|
|
|
120f1b7 |
.. _pep8: https://pep8.readthedocs.io/en/latest/
|
|
|
120f1b7 |
.. _Ghostscript: https://www.ghostscript.com/
|
|
|
120f1b7 |
-.. _Inkscape: https://inkscape.org>
|
|
|
120f1b7 |
+.. _Inkscape: https://inkscape.org/
|
|
|
120f1b7 |
|
|
|
120f1b7 |
.. note::
|
|
|
120f1b7 |
|
|
|
120f1b7 |
- **Additional dependencies for testing**: pytest_ (version 3.4 or later),
|
|
|
120f1b7 |
+ **Additional dependencies for testing**: pytest_ (version 3.6 or later),
|
|
|
120f1b7 |
Ghostscript_, Inkscape_
|
|
|
120f1b7 |
|
|
|
120f1b7 |
.. seealso::
|
|
|
120f1b7 |
diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst
|
|
|
120f1b7 |
index c3a5eb8f9..6e8c60fc6 100644
|
|
|
120f1b7 |
--- a/doc/devel/testing.rst
|
|
|
120f1b7 |
+++ b/doc/devel/testing.rst
|
|
|
120f1b7 |
@@ -21,11 +21,11 @@ Requirements
|
|
|
120f1b7 |
|
|
|
120f1b7 |
Install the latest version of Matplotlib as documented in
|
|
|
120f1b7 |
:ref:`installing_for_devs` In particular, follow the instructions to use a
|
|
|
120f1b7 |
-local FreeType build
|
|
|
120f1b7 |
+local FreeType build.
|
|
|
120f1b7 |
|
|
|
120f1b7 |
The following software is required to run the tests:
|
|
|
120f1b7 |
|
|
|
120f1b7 |
-- pytest_ (>=3.4)
|
|
|
120f1b7 |
+- pytest_ (>=3.6)
|
|
|
120f1b7 |
- Ghostscript_ (>= 9.0, to render PDF files)
|
|
|
120f1b7 |
- Inkscape_ (to render SVG files)
|
|
|
120f1b7 |
|
|
|
120f1b7 |
diff --git a/lib/matplotlib/testing/conftest.py b/lib/matplotlib/testing/conftest.py
|
|
|
120f1b7 |
index 96528c8de..8cb90e083 100644
|
|
|
120f1b7 |
--- a/lib/matplotlib/testing/conftest.py
|
|
|
120f1b7 |
+++ b/lib/matplotlib/testing/conftest.py
|
|
|
120f1b7 |
@@ -24,19 +24,19 @@ def mpl_test_settings(request):
|
|
|
120f1b7 |
with _cleanup_cm():
|
|
|
120f1b7 |
|
|
|
120f1b7 |
backend = None
|
|
|
120f1b7 |
- backend_marker = request.keywords.get('backend')
|
|
|
120f1b7 |
+ backend_marker = request.node.get_closest_marker('backend')
|
|
|
120f1b7 |
if backend_marker is not None:
|
|
|
120f1b7 |
assert len(backend_marker.args) == 1, \
|
|
|
120f1b7 |
"Marker 'backend' must specify 1 backend."
|
|
|
120f1b7 |
- backend = backend_marker.args[0]
|
|
|
120f1b7 |
+ backend, = backend_marker.args
|
|
|
120f1b7 |
prev_backend = matplotlib.get_backend()
|
|
|
120f1b7 |
|
|
|
120f1b7 |
style = '_classic_test' # Default of cleanup and image_comparison too.
|
|
|
120f1b7 |
- style_marker = request.keywords.get('style')
|
|
|
120f1b7 |
+ style_marker = request.node.get_closest_marker('style')
|
|
|
120f1b7 |
if style_marker is not None:
|
|
|
120f1b7 |
assert len(style_marker.args) == 1, \
|
|
|
120f1b7 |
"Marker 'style' must specify 1 style."
|
|
|
120f1b7 |
- style = style_marker.args[0]
|
|
|
120f1b7 |
+ style, = style_marker.args
|
|
|
120f1b7 |
|
|
|
120f1b7 |
matplotlib.testing.setup()
|
|
|
120f1b7 |
if backend is not None:
|
|
|
120f1b7 |
@@ -73,7 +73,7 @@ def mpl_image_comparison_parameters(request, extension):
|
|
|
120f1b7 |
# pytest won't get confused.
|
|
|
120f1b7 |
# We annotate the decorated function with any parameters captured by this
|
|
|
120f1b7 |
# fixture so that they can be used by the wrapper in image_comparison.
|
|
|
120f1b7 |
- baseline_images = request.keywords['baseline_images'].args[0]
|
|
|
120f1b7 |
+ baseline_images, = request.node.get_closest_marker('baseline_images').args
|
|
|
120f1b7 |
if baseline_images is None:
|
|
|
120f1b7 |
# Allow baseline image list to be produced on the fly based on current
|
|
|
120f1b7 |
# parametrization.
|
|
|
120f1b7 |
diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py
|
|
|
120f1b7 |
index f3fc47c68..c1bb1fdc2 100644
|
|
|
120f1b7 |
--- a/lib/matplotlib/testing/decorators.py
|
|
|
120f1b7 |
+++ b/lib/matplotlib/testing/decorators.py
|
|
|
120f1b7 |
@@ -215,8 +215,12 @@ class _ImageComparisonBase(object):
|
|
|
120f1b7 |
if self.remove_text:
|
|
|
120f1b7 |
remove_ticks_and_titles(fig)
|
|
|
120f1b7 |
|
|
|
120f1b7 |
+ ext = extension.args[0] if hasattr(extension, 'args') else extension
|
|
|
120f1b7 |
+ # XXX this is needed twice for test_mixedsubplots[extension2]
|
|
|
120f1b7 |
+ ext = ext.args[0] if hasattr(ext, 'args') else ext
|
|
|
120f1b7 |
+
|
|
|
120f1b7 |
actual_fname = (
|
|
|
120f1b7 |
- os.path.join(self.result_dir, baseline) + '.' + extension)
|
|
|
120f1b7 |
+ os.path.join(self.result_dir, baseline) + '.' + ext)
|
|
|
120f1b7 |
kwargs = self.savefig_kwargs.copy()
|
|
|
120f1b7 |
if extension == 'pdf':
|
|
|
120f1b7 |
kwargs.setdefault('metadata',
|
|
|
120f1b7 |
@@ -224,7 +228,7 @@ class _ImageComparisonBase(object):
|
|
|
120f1b7 |
'CreationDate': None})
|
|
|
120f1b7 |
fig.savefig(actual_fname, **kwargs)
|
|
|
120f1b7 |
|
|
|
120f1b7 |
- expected_fname = self.copy_baseline(baseline, extension)
|
|
|
120f1b7 |
+ expected_fname = self.copy_baseline(baseline, ext)
|
|
|
120f1b7 |
_raise_on_image_difference(expected_fname, actual_fname, self.tol)
|
|
|
120f1b7 |
|
|
|
120f1b7 |
|
|
|
120f1b7 |
diff --git a/requirements/testing/travis35.txt b/requirements/testing/travis35.txt
|
|
|
120f1b7 |
index fc3c3428b..f137d3bbb 100644
|
|
|
120f1b7 |
--- a/requirements/testing/travis35.txt
|
|
|
120f1b7 |
+++ b/requirements/testing/travis35.txt
|
|
|
120f1b7 |
@@ -5,7 +5,7 @@ python-dateutil==2.1
|
|
|
120f1b7 |
numpy==1.10.0
|
|
|
120f1b7 |
pandas<0.21.0
|
|
|
120f1b7 |
pyparsing==2.0.1
|
|
|
120f1b7 |
-pytest==3.4
|
|
|
120f1b7 |
+pytest==3.6
|
|
|
120f1b7 |
pytest-cov==2.3.1
|
|
|
120f1b7 |
pytest-timeout==1.2.1 # Newer pytest-timeouts don't support pytest 3.4.
|
|
|
120f1b7 |
pytest-rerunfailures<5 # newer versions require pytest3.6
|
|
|
120f1b7 |
diff --git a/requirements/testing/travis_all.txt b/requirements/testing/travis_all.txt
|
|
|
120f1b7 |
index dcffd281e..3f5811b1b 100644
|
|
|
120f1b7 |
--- a/requirements/testing/travis_all.txt
|
|
|
120f1b7 |
+++ b/requirements/testing/travis_all.txt
|
|
|
120f1b7 |
@@ -6,9 +6,7 @@ cycler
|
|
|
120f1b7 |
numpy
|
|
|
120f1b7 |
pillow
|
|
|
120f1b7 |
pyparsing
|
|
|
120f1b7 |
-# pytest-timeout master depends on pytest>=3.6. Testing with pytest 3.4 is
|
|
|
120f1b7 |
-# still supported; this is tested by the first travis python 3.5 build
|
|
|
120f1b7 |
-pytest>=3.6,<4
|
|
|
120f1b7 |
+pytest
|
|
|
120f1b7 |
pytest-cov
|
|
|
120f1b7 |
pytest-faulthandler
|
|
|
120f1b7 |
pytest-rerunfailures
|
|
|
120f1b7 |
diff --git a/setupext.py b/setupext.py
|
|
|
120f1b7 |
index fc82d5d15..186217648 100644
|
|
|
120f1b7 |
--- a/setupext.py
|
|
|
120f1b7 |
+++ b/setupext.py
|
|
|
120f1b7 |
@@ -821,7 +821,7 @@ class Toolkits(OptionalPackage):
|
|
|
120f1b7 |
|
|
|
120f1b7 |
class Tests(OptionalPackage):
|
|
|
120f1b7 |
name = "tests"
|
|
|
120f1b7 |
- pytest_min_version = '3.4'
|
|
|
120f1b7 |
+ pytest_min_version = '3.6'
|
|
|
120f1b7 |
default_config = False
|
|
|
120f1b7 |
|
|
|
120f1b7 |
def check(self):
|
|
|
120f1b7 |
--
|
|
|
120f1b7 |
2.21.0
|
|
|
120f1b7 |
|