Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a5064c

Browse filesBrowse files
authored
Merge pull request #13181 from ArchangeGabriel/auto-backport-of-pr-12154-on-v2.2.x
Backport PRs #12154, #12294, #12297, #12316, #13159 & #13205 to fix multiple tests issues
2 parents 8482916 + 62cc084 commit 4a5064c
Copy full SHA for 4a5064c
Expand file treeCollapse file tree

22 files changed

+109
-89
lines changed
Open diff view settings
Collapse file

‎.appveyor.yml‎

Copy file name to clipboardExpand all lines: .appveyor.yml
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ install:
6666
- activate test-environment
6767
- echo %PYTHON_VERSION% %TARGET_ARCH%
6868
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
69-
- pip install -q "pytest!=3.3.0,>=3.2.0,<3.8" "pytest-cov>=2.3.1"
70-
pytest-rerunfailures pytest-timeout pytest-xdist
69+
- pip install -q "pytest>=3.6.1" "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-xdist
7170

7271
# Apply patch to `subprocess` on Python versions > 2 and < 3.6.3
7372
# https://github.com/matplotlib/matplotlib/issues/9176
Collapse file

‎.travis.yml‎

Copy file name to clipboardExpand all lines: .travis.yml
+9-12Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ language: python
33
dist: xenial
44
sudo: false
55

6+
services:
7+
- xvfb
8+
69
branches:
710
except:
811
- /^auto-backport-of-pr-\d*/
@@ -37,6 +40,7 @@ addons:
3740
- texlive-latex-extra
3841
- texlive-latex-recommended
3942
- texlive-xetex
43+
- xvfb
4044

4145
env:
4246
global:
@@ -53,9 +57,7 @@ env:
5357
- PANDAS=
5458
- PILLOW=pillow
5559
- PYPARSING=pyparsing
56-
# pytest-timeout master depends on pytest>=3.6. Testing with pytest 3.1 is
57-
# still supported; this is tested by the first matrix entry.
58-
- PYTEST='pytest>=3.6,<3.8'
60+
- PYTEST='pytest>=3.6.1'
5961
- PYTEST_COV=pytest-cov
6062
- PYTEST_RERUNFAILURES=pytest-rerunfailures
6163
- PYTEST_PEP8=
@@ -72,6 +74,7 @@ matrix:
7274
include:
7375
- python: 2.7
7476
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124.
77+
# pytest>=3.6.1 due to https://github.com/pytest-dev/pytest/commit/b5a94d8e6c49201c8c79a7c52b8466e020e6d6b8
7578
env:
7679
- CYCLER=cycler==0.10
7780
- DATEUTIL=python-dateutil==2.1
@@ -80,10 +83,10 @@ matrix:
8083
- NUMPY=numpy==1.7.1
8184
- PANDAS='pandas<0.21.0'
8285
- PYPARSING=pyparsing==2.0.1
83-
- PYTEST=pytest==3.1.0
86+
- PYTEST=pytest==3.6.1
8487
- PYTEST_COV=pytest-cov==2.3.1
88+
- PYTEST_RERUNFAILURES='pytest-rerunfailures<6' # 6 needs pytest >=3.8
8589
- PYTEST_TIMEOUT=pytest-timeout==1.2.1 # Newer pytest-timeouts don't support pytest <3.4.
86-
- PYTEST_RERUNFAILURES='pytest-rerunfailures<5' # 5 needs pytest>=3.6
8790
- SPHINX=sphinx==1.3
8891
- python: 3.4
8992
env: PYTHON_ARGS=-OO
@@ -122,7 +125,7 @@ before_install:
122125
else
123126
brew update
124127
brew tap homebrew/gui
125-
brew install python libpng ffmpeg imagemagick mplayer ccache
128+
# brew install python libpng ffmpeg imagemagick mplayer ccache
126129
# We could install ghostscript and inkscape here to test svg and pdf
127130
# but this makes the test time really long.
128131
# brew install ghostscript inkscape
@@ -189,12 +192,6 @@ install:
189192
# Install matplotlib
190193
pip install -ve .
191194
192-
before_script:
193-
- |
194-
if [[ $TRAVIS_OS_NAME != 'osx' ]]; then
195-
export DISPLAY=:99.0
196-
sh -e /etc/init.d/xvfb start
197-
fi
198195
199196
script: ci/travis/test_script.sh
200197

Collapse file

‎doc/devel/contributing.rst‎

Copy file name to clipboardExpand all lines: doc/devel/contributing.rst
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ value.
109109
Installing Matplotlib in developer mode
110110
---------------------------------------
111111

112-
To install Matplotlib (and compile the c-extensions) run the following
112+
To install Matplotlib (and compile the C-extensions) run the following
113113
command from the top-level directory ::
114114

115115
python -mpip install -ve .
@@ -148,11 +148,11 @@ environment is set up properly::
148148
.. _pep8: https://pep8.readthedocs.io/en/latest/
149149
.. _mock: https://docs.python.org/dev/library/unittest.mock.html
150150
.. _Ghostscript: https://www.ghostscript.com/
151-
.. _Inkscape: https://inkscape.org>
151+
.. _Inkscape: https://inkscape.org/
152152

153153
.. note::
154154

155-
**Additional dependencies for testing**: pytest_ (version 3.1 or later),
155+
**Additional dependencies for testing**: pytest_ (version 3.6 or later),
156156
mock_ (if Python 2), Ghostscript_, Inkscape_
157157

158158
.. seealso::
Collapse file

‎doc/devel/testing.rst‎

Copy file name to clipboardExpand all lines: doc/devel/testing.rst
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Requirements
2222

2323
Install the latest version of Matplotlib as documented in
2424
:ref:`installing_for_devs` In particular, follow the instructions to use a
25-
local FreeType build
25+
local FreeType build.
2626

2727
The following software is required to run the tests:
2828

29-
- pytest_ (>=3.1)
29+
- pytest_ (>=3.6)
3030
- mock_, when running Python 2
3131
- Ghostscript_ (to render PDF files)
3232
- Inkscape_ (to render SVG files)
Collapse file

‎lib/matplotlib/backends/backend_agg.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def post_processing(image, dpi):
391391
self._update_methods()
392392

393393
if w > 0 and h > 0:
394-
img = np.fromstring(buffer, np.uint8)
394+
img = np.frombuffer(buffer, np.uint8)
395395
img, ox, oy = post_processing(img.reshape((h, w, 4)) / 255.,
396396
self.dpi)
397397
gc = self.new_gc()
Collapse file

‎lib/matplotlib/dates.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/dates.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,10 +1369,9 @@ def get_locator(self, dmin, dmax):
13691369
else:
13701370
locator = MicrosecondLocator(interval, tz=self.tz)
13711371
if dmin.year > 20 and interval < 1000:
1372-
_log.warn('Plotting microsecond time intervals is not'
1373-
' well supported. Please see the'
1374-
' MicrosecondLocator documentation'
1375-
' for details.')
1372+
_log.warning('Plotting microsecond time intervals is not well '
1373+
'supported. Please see the MicrosecondLocator '
1374+
'documentation for details.')
13761375

13771376
locator.set_axis(self.axis)
13781377

Collapse file

‎lib/matplotlib/image.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,9 +1447,9 @@ def pil_to_array(pilImage):
14471447
# return MxN luminance array of uint16
14481448
raw = pilImage.tobytes('raw', pilImage.mode)
14491449
if pilImage.mode.endswith('B'):
1450-
x = np.fromstring(raw, '>u2')
1450+
x = np.frombuffer(raw, '>u2')
14511451
else:
1452-
x = np.fromstring(raw, '<u2')
1452+
x = np.frombuffer(raw, '<u2')
14531453
return x.reshape(pilImage.size[::-1]).astype('=u2')
14541454
else: # try to convert to an rgba image
14551455
try:
Collapse file

‎lib/matplotlib/testing/conftest.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/conftest.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ def mpl_test_settings(request):
2424
original_settings = matplotlib.rcParams.copy()
2525

2626
backend = None
27-
backend_marker = request.keywords.get('backend')
27+
backend_marker = request.node.get_closest_marker('backend')
2828
if backend_marker is not None:
2929
assert len(backend_marker.args) == 1, \
3030
"Marker 'backend' must specify 1 backend."
31-
backend = backend_marker.args[0]
31+
backend, = backend_marker.args
3232
prev_backend = matplotlib.get_backend()
3333

3434
style = '_classic_test' # Default of cleanup and image_comparison too.
35-
style_marker = request.keywords.get('style')
35+
style_marker = request.node.get_closest_marker('style')
3636
if style_marker is not None:
3737
assert len(style_marker.args) == 1, \
3838
"Marker 'style' must specify 1 style."
39-
style = style_marker.args[0]
39+
style, = style_marker.args
4040

4141
matplotlib.testing.setup()
4242
if backend is not None:
@@ -64,7 +64,7 @@ def mpl_image_comparison_parameters(request, extension):
6464
# pytest won't get confused.
6565
# We annotate the decorated function with any parameters captured by this
6666
# fixture so that they can be used by the wrapper in image_comparison.
67-
baseline_images = request.keywords['baseline_images'].args[0]
67+
baseline_images, = request.node.get_closest_marker('baseline_images').args
6868
if baseline_images is None:
6969
# Allow baseline image list to be produced on the fly based on current
7070
# parametrization.
Collapse file

‎lib/matplotlib/testing/decorators.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,25 @@ def _xfail_if_format_is_uncomparable(extension):
223223

224224
def _mark_xfail_if_format_is_uncomparable(extension):
225225
if isinstance(extension, six.string_types):
226-
will_fail = extension not in comparable_formats()
226+
name = extension
227+
marks = []
228+
elif isinstance(extension, tuple):
229+
# Extension might be a pytest ParameterSet instead of a plain string.
230+
# Unfortunately, this type is not exposed, so since it's a namedtuple,
231+
# check for a tuple instead.
232+
name = extension.values[0]
233+
marks = list(extension.marks)
227234
else:
228235
# Extension might be a pytest marker instead of a plain string.
229-
will_fail = extension.args[0] not in comparable_formats()
230-
if will_fail:
231-
fail_msg = 'Cannot compare %s files on this system' % extension
236+
name = extension.args[0]
237+
marks = [extension.mark]
238+
239+
if name not in comparable_formats():
240+
fail_msg = 'Cannot compare %s files on this system' % (name, )
232241
import pytest
233-
return pytest.mark.xfail(extension, reason=fail_msg, strict=False,
234-
raises=ImageComparisonFailure)
242+
marks += [pytest.mark.xfail(reason=fail_msg, strict=False,
243+
raises=ImageComparisonFailure)]
244+
return pytest.param(name, marks=marks)
235245
else:
236246
return extension
237247

Collapse file

‎lib/matplotlib/tests/test_backend_pdf.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pdf.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import sys
1010
import tempfile
11+
import warnings
1112

1213
import numpy as np
1314
import pytest
@@ -20,9 +21,11 @@
2021
_determinism_check)
2122

2223

23-
needs_usetex = pytest.mark.xfail(
24-
not checkdep_usetex(True),
25-
reason="This test needs a TeX installation")
24+
with warnings.catch_warnings():
25+
warnings.simplefilter('ignore')
26+
needs_usetex = pytest.mark.skipif(
27+
not checkdep_usetex(True),
28+
reason="This test needs a TeX installation")
2629

2730

2831
@image_comparison(baseline_images=['pdf_use14corefonts'],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.