Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4a5064c

Browse 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 parents8482916 +62cc084 commit4a5064c

22 files changed

+109
-89
lines changed

‎.appveyor.yml

Lines 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

‎.travis.yml

Lines 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

‎doc/devel/contributing.rst

Lines changed: 3 additions & 3 deletions
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 thec-extensions) run the following
112+
To install Matplotlib (and compile theC-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::

‎doc/devel/testing.rst

Lines changed: 2 additions & 2 deletions
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)

‎lib/matplotlib/backends/backend_agg.py

Lines 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
ifw>0andh>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()

‎lib/matplotlib/dates.py

Lines 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
ifdmin.year>20andinterval<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

‎lib/matplotlib/image.py

Lines 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
ifpilImage.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
returnx.reshape(pilImage.size[::-1]).astype('=u2')
14541454
else:# try to convert to an rgba image
14551455
try:

‎lib/matplotlib/testing/conftest.py

Lines 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
ifbackend_markerisnotNone:
2929
assertlen(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
ifstyle_markerisnotNone:
3737
assertlen(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
ifbackendisnotNone:
@@ -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
ifbaseline_imagesisNone:
6969
# Allow baseline image list to be produced on the fly based on current
7070
# parametrization.

‎lib/matplotlib/testing/decorators.py

Lines 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
ifisinstance(extension,six.string_types):
226-
will_fail=extensionnotincomparable_formats()
226+
name=extension
227+
marks= []
228+
elifisinstance(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]notincomparable_formats()
230-
ifwill_fail:
231-
fail_msg='Cannot compare %s files on this system'%extension
236+
name=extension.args[0]
237+
marks= [extension.mark]
238+
239+
ifnamenotincomparable_formats():
240+
fail_msg='Cannot compare %s files on this system'% (name, )
232241
importpytest
233-
returnpytest.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+
returnpytest.param(name,marks=marks)
235245
else:
236246
returnextension
237247

‎lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
importos
99
importsys
1010
importtempfile
11+
importwarnings
1112

1213
importnumpyasnp
1314
importpytest
@@ -20,9 +21,11 @@
2021
_determinism_check)
2122

2223

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

2730

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

‎lib/matplotlib/tests/test_backend_ps.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
importio
66
importre
7+
importwarnings
78

89
importnumpyasnp
910
importpytest
@@ -17,27 +18,30 @@
1718
_determinism_check)
1819

1920

20-
needs_ghostscript=pytest.mark.xfail(
21-
matplotlib.checkdep_ghostscript()[0]isNone,
22-
reason="This test needs a ghostscript installation")
23-
24-
25-
needs_usetex=pytest.mark.xfail(
26-
notmatplotlib.checkdep_usetex(True),
27-
reason="This test needs a TeX installation")
21+
withwarnings.catch_warnings():
22+
warnings.simplefilter('ignore')
23+
needs_ghostscript=pytest.mark.skipif(
24+
matplotlib.checkdep_ghostscript()[0]isNone,
25+
reason="This test needs a ghostscript installation")
26+
needs_usetex=pytest.mark.skipif(
27+
notmatplotlib.checkdep_usetex(True),
28+
reason="This test needs a TeX installation")
2829

2930

3031
# This tests tends to hit a TeX cache lock on AppVeyor.
3132
@pytest.mark.flaky(reruns=3)
3233
@pytest.mark.parametrize('format, use_log, rcParams', [
3334
('ps',False, {}),
34-
needs_ghostscript(('ps',False, {'ps.usedistiller':'ghostscript'})),
35-
needs_usetex(needs_ghostscript(('ps',False, {'text.latex.unicode':True,
36-
'text.usetex':True}))),
35+
pytest.param('ps',False, {'ps.usedistiller':'ghostscript'},
36+
marks=needs_ghostscript),
37+
pytest.param('ps',False, {'text.latex.unicode':True,
38+
'text.usetex':True},
39+
marks=[needs_ghostscript,needs_usetex]),
3740
('eps',False, {}),
3841
('eps',True, {'ps.useafm':True}),
39-
needs_usetex(needs_ghostscript(('eps',False, {'text.latex.unicode':True,
40-
'text.usetex':True}))),
42+
pytest.param('eps',False, {'text.latex.unicode':True,
43+
'text.usetex':True},
44+
marks=[needs_ghostscript,needs_usetex]),
4145
],ids=[
4246
'ps',
4347
'ps with distiller',

‎lib/matplotlib/tests/test_backend_qt4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
py_qt_ver=QtCore.__version_info__[0]
3030

3131
ifpy_qt_ver!=4:
32-
pytestmark=pytest.mark.xfail(reason='Qt4 is not available')
32+
pytestmark=pytest.mark.skipif(reason='Qt4 is not available')
3333

3434

3535
@pytest.mark.backend('Qt4Agg')

‎lib/matplotlib/tests/test_backend_svg.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
fromioimportBytesIO
77
importos
88
importtempfile
9+
importwarnings
910
importxml.parsers.expat
1011

1112
importpytest
@@ -16,9 +17,11 @@
1617
frommatplotlibimportdviread
1718

1819

19-
needs_usetex=pytest.mark.xfail(
20-
notmatplotlib.checkdep_usetex(True),
21-
reason="This test needs a TeX installation")
20+
withwarnings.catch_warnings():
21+
warnings.simplefilter('ignore')
22+
needs_usetex=pytest.mark.skipif(
23+
notmatplotlib.checkdep_usetex(True),
24+
reason="This test needs a TeX installation")
2225

2326

2427
deftest_visibility():
@@ -130,7 +133,7 @@ def _test_determinism_save(filename, usetex):
130133
"filename, usetex",
131134
# unique filenames to allow for parallel testing
132135
[("determinism_notex.svg",False),
133-
needs_usetex(("determinism_tex.svg",True))])
136+
pytest.param("determinism_tex.svg",True,marks=needs_usetex)])
134137
deftest_determinism(filename,usetex):
135138
importsys
136139
fromsubprocessimportcheck_output,STDOUT,CalledProcessError

‎lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ def _get_testable_interactive_backends():
3131
reason="No $DISPLAY"
3232
elifany(importlib.util.find_spec(dep)isNonefordepindeps):
3333
reason="Missing dependency"
34-
backends.append(pytest.mark.skip(reason=reason)(backend)ifreason
35-
elsebackend)
34+
ifreason:
35+
backend=pytest.param(
36+
backend,marks=pytest.mark.skip(reason=reason))
37+
backends.append(backend)
3638
returnbackends
3739

3840

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp