Skip to content

Commit f20cc01

Browse files
committed
Added travis and appveyor pytest builds
1 parent dadeac9 commit f20cc01

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

.travis.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ env:
4545
- NPROC=2
4646
- TEST_ARGS=--no-pep8
4747
- NOSE_ARGS="--processes=$NPROC --process-timeout=300"
48+
- PYTEST_ARGS="-ra --timeout=300 --durations=25 --cov-report= --cov=lib" # -n $NPROC
4849
- PYTHON_ARGS=
4950
- DELETE_FONT_CACHE=
51+
- USE_PYTEST=false
52+
#- PYTHONHASHSEED=0 # Workaround for pytest-xdist flaky colletion order
53+
# # https://github.com/pytest-dev/pytest/issues/920
54+
# # https://github.com/pytest-dev/pytest/issues/1075
5055

5156
matrix:
5257
include:
@@ -60,6 +65,8 @@ matrix:
6065
env: TEST_ARGS=--pep8
6166
- python: 3.5
6267
env: BUILD_DOCS=true
68+
- python: 3.5
69+
env: USE_PYTEST=true PANDAS=pandas DELETE_FONT_CACHE=1 TEST_ARGS=
6370
- python: "nightly"
6471
env: PRE=--pre
6572
- os: osx
@@ -107,10 +114,14 @@ install:
107114
# Install dependencies from pypi
108115
pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.6 $PANDAS pep8 cycler coveralls coverage
109116
pip install $PRE pillow sphinx!=1.3.0 $MOCK numpydoc ipython colorspacious
117+
110118
# Install nose from a build which has partial
111119
# support for python36 and suport for coverage output suppressing
112120
pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose
113121
122+
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
123+
pip install $PRE pytest 'pytest-cov>=2.3.1' pytest-timeout pytest-xdist pytest-faulthandler
124+
114125
# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
115126
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
116127
# version since is it basically just a .ttf file
@@ -147,16 +158,21 @@ script:
147158
- |
148159
echo Testing import of tkagg backend
149160
MPLBACKEND="tkagg" python -c 'import matplotlib.pyplot as plt; print(plt.get_backend())'
150-
echo The following args are passed to nose $NOSE_ARGS
151161
if [[ $BUILD_DOCS == false ]]; then
152162
if [[ $DELETE_FONT_CACHE == 1 ]]; then
153163
rm -rf ~/.cache/matplotlib
154164
fi
155165
export MPL_REPO_DIR=$PWD # needed for pep8-conformance test of the examples
156-
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
157-
python tests.py $NOSE_ARGS $TEST_ARGS
166+
if [[ $USE_PYTEST == false ]]; then
167+
echo The following args are passed to nose $NOSE_ARGS
168+
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
169+
python tests.py $NOSE_ARGS $TEST_ARGS
170+
else
171+
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
172+
fi
158173
else
159-
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
174+
echo The following args are passed to pytest $PYTEST_ARGS
175+
py.test $PYTEST_ARGS $TEST_ARGS
160176
fi
161177
else
162178
cd doc
@@ -171,6 +187,9 @@ script:
171187
pip install $PRE requests==2.9.2 linkchecker
172188
linkchecker build/html/index.html
173189
fi
190+
# Currently disabled because of differece in behaviour
191+
# between `pytest-cov` and `nose-coverage`
192+
#- if [[ $USE_PYTEST == true ]]; then coveralls; fi
174193
- rm -rf $HOME/.cache/matplotlib/tex.cache
175194
- rm -rf $HOME/.cache/matplotlib/test_cache
176195

appveyor.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ 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=25 #--cov-report= --cov=lib #-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:
1925
# for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
@@ -38,6 +44,13 @@ environment:
3844
PYTHON_VERSION: "3.5"
3945
TEST_ALL: "no"
4046
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
47+
- TARGET_ARCH: "x64"
48+
CONDA_PY: "35"
49+
CONDA_NPY: "110"
50+
PYTHON_VERSION: "3.5"
51+
TEST_ALL: "no"
52+
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
53+
USE_PYTEST: yes
4154
- TARGET_ARCH: "x86"
4255
CONDA_PY: "27"
4356
CONDA_NPY: "18"
@@ -58,7 +71,7 @@ platform:
5871
build: false
5972

6073
init:
61-
- cmd: "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
74+
- cmd: "ECHO %PYTHON_VERSION% PYTEST=%USE_PYTEST% %CONDA_INSTALL_LOCN%"
6275

6376
install:
6477
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
@@ -82,10 +95,15 @@ install:
8295
# same things as the requirements in ci/conda_recipe/meta.yaml
8396
# if conda-forge gets a new pyqt, it might be nice to install it as well to have more backends
8497
# 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
98+
- conda create -q -n test-environment python=%PYTHON_VERSION%
99+
pip setuptools numpy python-dateutil freetype=2.6 msinttypes "tk=8.5"
100+
pyparsing pytz tornado "libpng>=1.6.21,<1.7" "zlib=1.2" "cycler>=0.10"
101+
nose mock sphinx
86102
- activate test-environment
87103
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
88104
- cmd: IF %PYTHON_VERSION% == 2.7 conda install -q functools32
105+
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
106+
- if x%USE_PYTEST% == xyes conda install -q pytest "pytest-cov>=2.3.1" pytest-timeout #pytest-xdist
89107

90108
# Let the install prefer the static builds of the libs
91109
- set LIBRARY_LIB=%CONDA_PREFIX%\Library\lib
@@ -124,7 +142,9 @@ test_script:
124142
# Test import of tkagg backend
125143
- python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
126144
# tests
127-
- python tests.py
145+
- if x%USE_PYTEST% == xyes echo The following args are passed to pytest %PYTEST_ARGS%
146+
- if x%USE_PYTEST% == xyes py.test %PYTEST_ARGS% %TEST_ARGS%
147+
- if x%USE_PYTEST% == xno python tests.py %TEST_ARGS%
128148
# Generate a html for visual tests
129149
- python visual_tests.py
130150

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
norecursedirs = .git build ci dist extern release tools unit
2+
norecursedirs = .git build ci dist extern release tools unit venv

0 commit comments

Comments
 (0)