From a3b9ef7c7c8750ff65d9341fb20811b2c4c99a73 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 18 Sep 2018 18:46:50 +0200 Subject: [PATCH] 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 +++++----- requirements/testing/travis35.txt | 2 +- requirements/testing/travis_all.txt | 4 +--- setupext.py | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/devel/contributing.rst b/doc/devel/contributing.rst index edf5d2228fd3..428fd0b29787 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 7ac880a1f490..7d03899751c8 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_ (to render PDF files) - Inkscape_ (to render SVG files) diff --git a/lib/matplotlib/testing/conftest.py b/lib/matplotlib/testing/conftest.py index 40ce56c4895a..d2f699c2be81 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: @@ -64,7 +64,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/requirements/testing/travis35.txt b/requirements/testing/travis35.txt index 67a58014dab0..dc476e67fad5 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. sphinx==1.3 diff --git a/requirements/testing/travis_all.txt b/requirements/testing/travis_all.txt index 364e43fd8875..3f5811b1b778 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 +pytest pytest-cov pytest-faulthandler pytest-rerunfailures diff --git a/setupext.py b/setupext.py index 947a3881f26d..7bf7dbfebc5a 100644 --- a/setupext.py +++ b/setupext.py @@ -681,7 +681,7 @@ def get_namespace_packages(self): class Tests(OptionalPackage): name = "tests" - pytest_min_version = '3.4' + pytest_min_version = '3.6' default_config = False def check(self):