Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 405e595

Browse files
authored
Merge pull request #8346 from QuLogic/pytest-plugins
TST: Use some more pytest plugins: warnings & rerunfailures
2 parents 6a49856 + 28c8fef commit 405e595

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ environment:
1414
CMD_IN_ENV: cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd
1515
# Workaround for https://github.com/conda/conda-build/issues/636
1616
PYTHONIOENCODING: UTF-8
17-
PYTEST_ARGS: -ra --timeout=300 --durations=25 -n %NUMBER_OF_PROCESSORS% --cov-report= --cov=lib -m "not network"
17+
PYTEST_ARGS: -rawR --timeout=300 --durations=25 -n %NUMBER_OF_PROCESSORS% --cov-report= --cov=lib -m "not network"
1818
PYTHONHASHSEED: 0 # Workaround for pytest-xdist flaky collection order
1919
# https://github.com/pytest-dev/pytest/issues/920
2020
# https://github.com/pytest-dev/pytest/issues/1075
@@ -94,7 +94,7 @@ install:
9494
- echo %PYTHON_VERSION% %TARGET_ARCH%
9595
- if %PYTHON_VERSION% == 2.7 conda install -q backports.functools_lru_cache
9696
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
97-
- conda install -q pytest "pytest-cov>=2.3.1" pytest-timeout pytest-xdist
97+
- pip install -q pytest "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-warnings pytest-xdist
9898

9999
# Let the install prefer the static builds of the libs
100100
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ env:
4646
- INSTALL_PEP8=
4747
- RUN_PEP8=
4848
- NOSE=
49-
- PYTEST_ARGS="-ra --maxfail=1 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
49+
- PYTEST_ARGS="-rawR --maxfail=1 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
5050
- PYTHON_ARGS=
5151
- DELETE_FONT_CACHE=
5252

@@ -119,7 +119,7 @@ install:
119119
pip install $PRE -r doc-requirements.txt
120120
121121
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
122-
pip install $PRE pytest 'pytest-cov>=2.3.1' pytest-timeout pytest-xdist pytest-faulthandler $INSTALL_PEP8
122+
pip install $PRE pytest 'pytest-cov>=2.3.1' pytest-faulthandler pytest-rerunfailures pytest-timeout pytest-warnings pytest-xdist $INSTALL_PEP8
123123
124124
# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
125125
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
@@ -142,7 +142,7 @@ install:
142142
# Install matplotlib
143143
pip install -ve .
144144
145-
script: source ci/travis/test_script.sh
145+
script: ci/travis/test_script.sh
146146

147147
before_cache:
148148
- rm -rf $HOME/.cache/matplotlib/tex.cache

ci/travis/test_script.sh

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! /bin/bash
22

3+
set -e
4+
35
# This script is meant to be called by the "script" step defined in
46
# .travis.yml. See http://docs.travis-ci.com/ for more details.
57
# The behavior of the script is controlled by environment variabled defined
@@ -34,7 +36,6 @@ else
3436
# We don't build the LaTeX docs here, so linkchecker will complain
3537
touch build/html/Matplotlib.pdf
3638
# Linkchecker only works with python 2.7 for the time being
37-
deactivate
3839
source ~/virtualenv/python2.7/bin/activate
3940
pip install pip --upgrade
4041
# linkchecker is currently broken with requests 2.10.0 so force an earlier version

lib/matplotlib/tests/test_lines.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
from matplotlib.testing.decorators import image_comparison
1717

1818

19+
# Runtimes on a loaded system are inherently flaky. Not so much that a rerun
20+
# won't help, hopefully.
21+
@pytest.mark.flaky(reruns=3)
1922
def test_invisible_Line_rendering():
2023
"""
2124
Github issue #1256 identified a bug in Line.draw method

lib/matplotlib/tests/test_mathtext.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ def baseline_images(request, fontset, index):
167167
return ['%s_%s_%02d' % (request.param, fontset, index)]
168168

169169

170+
# See #7911 for why these tests are flaky and #7107 for why they are not so
171+
# easy to fix.
172+
@pytest.mark.flaky(reruns=3)
170173
@pytest.mark.parametrize('index, test', enumerate(math_tests),
171174
ids=[str(index) for index in range(len(math_tests))])
172175
@pytest.mark.parametrize('fontset',
@@ -181,6 +184,9 @@ def test_mathtext_rendering(baseline_images, fontset, index, test):
181184
horizontalalignment='center', verticalalignment='center')
182185

183186

187+
# See #7911 for why these tests are flaky and #7107 for why they are not so
188+
# easy to fix.
189+
@pytest.mark.flaky(reruns=3)
184190
@pytest.mark.parametrize('index, test', enumerate(font_tests),
185191
ids=[str(index) for index in range(len(font_tests))])
186192
@pytest.mark.parametrize('fontset',

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ def test_lines3d():
108108
ax.plot(x, y, z)
109109

110110

111-
@image_comparison(baseline_images=['mixedsubplot'], remove_text=True)
111+
# Reason for flakiness of SVG test is still unknown.
112+
@image_comparison(baseline_images=['mixedsubplot'], remove_text=True,
113+
extensions=['png', 'pdf',
114+
pytest.mark.xfail('svg', strict=False)])
112115
def test_mixedsubplots():
113116
def f(t):
114117
s1 = np.cos(2*np.pi*t)

0 commit comments

Comments
 (0)