10000 Added travis and appveyor pytest builds · matplotlib/matplotlib@e8a4d60 · GitHub
[go: up one dir, main page]

Skip to content

Commit e8a4d60

Browse files
committed
Added travis and appveyor pytest builds
1 parent db30adf commit e8a4d60

File tree

3 files changed

+95
-40
lines changed

3 files changed

+95
-40
lines changed

.coveragerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ source=matplotlib
44
omit =
55
lib/matplotlib/tests/*
66
lib/matplotlib/testing/*
7+
lib/matplotlib/sphinxext/tests/*
8+
lib/matplotlib/backends/backend_gdk.py
9+
lib/matplotlib/backends/backend_gtk.py
10+
lib/matplotlib/backends/backend_wx.py
11+
lib/matplotlib/backends/qt4_compat.py
12+
lib/matplotlib/finance.py
713

814
exclude_lines =
915
raise NotImplemented

.travis.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,44 @@ env:
4444
- NPROC=2
4545
- TEST_ARGS=--no-pep8
4646
- NOSE_ARGS="--processes=$NPROC --process-timeout=300"
47+
- PYTEST_ARGS="-ra --timeout=300 --durations=30 --cov-report= --cov=lib/matplotlib" #-n $NPROC
4748
- PYTHON_ARGS=
49+
- USE_PYTEST=false
50+
- PYTHONHASHSEED=0 # Workaround for pytest-xdist flaky colletion order
51+
# https://github.com/pytest-dev/pytest/issues/920
52+
# https://github.com/pytest-dev/pytest/issues/1075
4853

4954
language: python
5055

5156
matrix:
5257
include:
58+
#- python: 2.7
59+
# env: MOCK=mock NUMPY=numpy==1.6
60+
#- python: 3.4
61+
# env: PYTHON_ARGS=-OO
62+
#- python: 3.5
63+
# env: PANDAS=pandas NOSE_ARGS=--with-coverage
64+
#- python: 3.5
65+
# env: TEST_ARGS=--pep8
66+
#- python: 3.5
67+
# env: BUILD_DOCS=true
68+
#- python: "nightly"
69+
# env: PRE=--pre
70+
#- os: osx
71+
# osx_image: xcode7.3
72+
# language: generic
73+
# env: MOCK=mock NOSE_ARGS=
5374
- python: 2.7
54-
env: MOCK=mock NUMPY=numpy==1.6
55-
- python: 3.4
56-
env: PYTHON_ARGS=-OO
75+
env: USE_PYTEST=true MOCK=mock NUMPY=numpy==1.6
5776
- python: 3.5
58-
env: PANDAS=pandas NOSE_ARGS=--with-coverage
59-
- python: 3.5
60-
env: TEST_ARGS=--pep8
61-
- python: 3.5
62-
env: BUILD_DOCS=true
63-
- python: "nightly"
64-
env: PRE=--pre
77+
env: USE_PYTEST=true PANDAS=pandas TEST_ARGS=
6578
- os: osx
6679
osx_image: xcode7.3
6780
language: generic
68-
env: MOCK=mock NOSE_ARGS=
81+
env: USE_PYTEST=true MOCK=mock
6982
allow_failures:
7083
- python: "nightly"
84+
#- env: USE_PYTEST=true
7185

7286
before_install:
7387
- |
@@ -98,10 +112,14 @@ install:
98112
# Install dependencies from pypi
99113
pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.2 $PANDAS pep8 cycler coveralls coverage
100114
pip install $PRE pillow sphinx!=1.3.0 $MOCK numpydoc ipython colorspacious
115+
101116
# Install nose from a build which has partial
102117
# support for python36 and suport for coverage output suppressing
103118
pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose
104119
120+
# Install Pytest. NOTE: Nose is still needed due to `nose.tool` usage
121+
pip install $PRE pytest pytest-cov pytest-timeout #pytest-xdist
122+
105123
# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
106124
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
107125
# version since is it basically just a .ttf file
@@ -137,13 +155,18 @@ script:
137155
- |
138156
echo Testing import of tkagg backend
139157
MPLBACKEND="tkagg" python -c 'import matplotlib.pyplot as plt; print(plt.get_backend())'
140-
echo The following args are passed to nose $NOSE_ARGS
141158
if [[ $BUILD_DOCS == false ]]; then
142159
export MPL_REPO_DIR=$PWD # needed for pep8-conformance test of the examples
143-
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
144-
python tests.py $NOSE_ARGS $TEST_ARGS
145-
else
146-
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
160+
if [[ $USE_PYTEST == false ]]; then
161+
echo The following args are passed to nose $NOSE_ARGS
162+
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
163+
python tests.py $NOSE_ARGS $TEST_ARGS
164+
else
165+
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
166+
fi
167+
else
168+
echo The following args are passed to pytest $PYTEST_ARGS
169+
py.test $PYTEST_ARGS $TEST_ARGS
147170
fi
148171
else
149172
cd doc
@@ -198,6 +221,6 @@ after_success:
198221
else
199222
echo "Will only deploy docs build from matplotlib master branch"
200223
fi
201-
if [[ $NOSE_ARGS="--with-coverage" ]]; then
224+
if [[ $NOSE_ARGS="--with-coverage" || $USE_PYTEST == true ]]; then
202225
coveralls
203226
fi

appveyor.yml

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,60 @@ 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+
TEST_ARGS: --no-pep8
18+
PYTEST_ARGS: -ra --timeout=300 --durations=30 #--cov-report= --cov=lib/matplotlib #-n %NUMBER_OF_PROCESSORS%
19+
USE_PYTEST: no
20+
PYTHONHASHSEED: 0 # Workaround for pytest-xdist flaky colletion order
21+
# https://github.com/pytest-dev/pytest/issues/920
22+
# https://github.com/pytest-dev/pytest/issues/1075
1723

1824
matrix:
19-
# for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
20-
# theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit,
21-
# one for 64bit because we construct envs anyway. But using one for the
22-
# right python version is hopefully making it fast due to package caching.
25+
## for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
26+
## theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit,
27+
## one for 64bit because we construct envs anyway. But using one for the
28+
## right python version is hopefully making it fast due to package caching.
29+
#- TARGET_ARCH: "x64"
30+
# CONDA_PY: "27"
31+
# CONDA_NPY: "18"
32+
# PYTHON_VERSION: "2.7"
33+
# TEST_ALL: "no"
34+
# CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
35+
#- TARGET_ARCH: "x64"
36+
# CONDA_PY: "34"
37+
# CONDA_NPY: "110"
38+
# PYTHON_VERSION: "3.4"
39+
# TEST_ALL: "no"
40+
# CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64"
41+
#- TARGET_ARCH: "x64"
42+
# CONDA_PY: "35"
43+
# CONDA_NPY: "110"
44+
# PYTHON_VERSION: "3.5"
45+
# TEST_ALL: "no"
46+
# CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
47+
#- TARGET_ARCH: "x86"
48+
# CONDA_PY: "27"
49+
# CONDA_NPY: "18"
50+
# PYTHON_VERSION: "2.7"
51+
# # this variable influence pdf/svg and most importantly the latex related tests
52+
# # which triples the runtime of the tests (7-8min vs 30min).
53+
# # pick the one which seems to make the most problems and run it last, so that
54+
# # the rest of the tests can give feedback earlier
55+
# TEST_ALL: "yes"
56+
# CONDA_INSTALL_LOCN: "C:\\Miniconda"
2357
- TARGET_ARCH: "x64"
2458
CONDA_PY: "27"
2559
CONDA_NPY: "18"
2660
PYTHON_VERSION: "2.7"
2761
TEST_ALL: "no"
2862
CONDA_INSTALL_LOCN: "C:\\Miniconda-x64"
29-
- TARGET_ARCH: "x64"
30-
CONDA_PY: "34"
31-
CONDA_NPY: "110"
32-
PYTHON_VERSION: "3.4"
33-
TEST_ALL: "no"
34-
CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64"
63+
USE_PYTEST: yes
3564
- TARGET_ARCH: "x64"
3665
CONDA_PY: "35"
3766
CONDA_NPY: "110"
3867
PYTHON_VERSION: "3.5"
3968
TEST_ALL: "no"
4069
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
41-
- TARGET_ARCH: "x86"
42-
CONDA_PY: "27"
43-
CONDA_NPY: "18"
44-
PYTHON_VERSION: "2.7"
45-
# this variable influence pdf/svg and most importantly the latex related tests
46-
# which triples the runtime of the tests (7-8min vs 30min).
47-
# pick the one which seems to make the most problems and run it last, so that
48-
# the rest of the tests can give feedback earlier
49-
TEST_ALL: "yes"
50-
CONDA_INSTALL_LOCN: "C:\\Miniconda"
70+
USE_PYTEST: yes
5171

5272
# We always use a 64-bit machine, but can build x86 distributions
5373
# with the PYTHON_ARCH variable (which is used by CMD_IN_ENV).
@@ -58,7 +78,7 @@ platform:
5878
build: false
5979

6080
init:
61-
- cmd: "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
81+
- cmd: "ECHO %PYTHON_VERSION% PYTEST=%USE_PYTEST% %CONDA_INSTALL_LOCN%"
6282

6383
install:
6484
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
@@ -82,10 +102,14 @@ install:
82102
# same things as the requirements in ci/conda_recipe/meta.yaml
83103
# if conda-forge gets a new pyqt, it might be nice to install it as well to have more backends
84104
# https://github.com/conda-forge/conda-forge.github.io/issues/157#issuecomment-223536381
85-
- cmd: conda create -q -n test-environment python=%PYTHON_VERSION% pip setuptools numpy python-dateutil freetype=2.6 msinttypes "tk=8.5" pyparsing pytz tornado "libpng>=1.6.21,<1.7" "zlib=1.2" "cycler>=0.10" nose mock
105+
- conda create -q -n test-environment python=%PYTHON_VERSION%
106+
pip setuptools numpy python-dateutil freetype=2.6 msinttypes "tk=8.5"
107+
pyparsing pytz tornado "libpng>=1.6.21,<1.7" "zlib=1.2" "cycler>=0.10"
108+
nose mock sphinx
86109
- activate test-environment
87110
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
88111
- cmd: A0A6 IF %PYTHON_VERSION% == 2.7 conda install -q functools32
112+
- if x%USE_PYTEST% == xyes conda install -q pytest pytest-cov pytest-timeout #pytest-xdist
89113

90114
# Let the install prefer the static builds of the libs
91115
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
@@ -124,7 +148,9 @@ test_script:
124148
# Test import of tkagg backend
125149
- python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
126150
# tests
127-
- python tests.py
151+
- if x%USE_PYTEST% == xyes echo The following args are passed to pytest %PYTEST_ARGS%
152+
- if x%USE_PYTEST% == xyes py.test %PYTEST_ARGS% %TEST_ARGS%
153+
- if x%USE_PYTEST% == xno python tests.py %TEST_ARGS%
128154
# Generate a html for visual tests
129155
- python visual_tests.py
130156

0 commit comments

Comments
 (0)
0