10000 Add Py.test testing framework support by Kojoley · Pull Request #6730 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add Py.test testing framework support #6730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 23, 2016
Merged
Prev Previous commit
Next Next commit
Added travis and appveyor pytest builds
  • Loading branch information
Kojoley committed Aug 21, 2016
commit f20cc014a4cd910cf60a647b4d2e13b7934a59bf
27 changes: 23 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ env:
- NPROC=2
- TEST_ARGS=--no-pep8
- NOSE_ARGS="--processes=$NPROC --process-timeout=300"
- PYTEST_ARGS="-ra --timeout=300 --durations=25 --cov-report= --cov=lib" # -n $NPROC
- PYTHON_ARGS=
- DELETE_FONT_CACHE=
- USE_PYTEST=false
#- PYTHONHASHSEED=0 # Workaround for pytest-xdist flaky colletion order
# # https://github.com/pytest-dev/pytest/issues/920
# # https://github.com/pytest-dev/pytest/issues/1075

matrix:
include:
Expand All @@ -60,6 +65,8 @@ matrix:
env: TEST_ARGS=--pep8
- python: 3.5
env: BUILD_DOCS=true
- python: 3.5
env: USE_PYTEST=true PANDAS=pandas DELETE_FONT_CACHE=1 TEST_ARGS=
- python: "nightly"
env: PRE=--pre
- os: osx
Expand Down Expand Up @@ -107,10 +114,14 @@ install:
# Install dependencies from pypi
pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.6 $PANDAS pep8 cycler coveralls coverage
pip install $PRE pillow sphinx!=1.3.0 $MOCK numpydoc ipython colorspacious

# Install nose from a build which has partial
# support for python36 and suport for coverage output suppressing
pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose

# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
pip install $PRE pytest 'pytest-cov>=2.3.1' pytest-timeout pytest-xdist pytest-faulthandler

# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
# version since is it basically just a .ttf file
Expand Down Expand Up @@ -147,16 +158,21 @@ script:
- |
echo Testing import of tkagg backend
MPLBACKEND="tkagg" python -c 'import matplotlib.pyplot as plt; print(plt.get_backend())'
echo The following args are passed to nose $NOSE_ARGS
if [[ $BUILD_DOCS == false ]]; then
if [[ $DELETE_FONT_CACHE == 1 ]]; then
rm -rf ~/.cache/matplotlib
fi
export MPL_REPO_DIR=$PWD # needed for pep8-conformance test of the examples
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
python tests.py $NOSE_ARGS $TEST_ARGS
if [[ $USE_PYTEST == false ]]; then
echo The following args are passed to nose $NOSE_ARGS
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
python tests.py $NOSE_ARGS $TEST_ARGS
else
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
fi
else
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
echo The following args are passed to pytest $PYTEST_ARGS
py.test $PYTEST_ARGS $TEST_ARGS
fi
else
cd doc
Expand All @@ -171,6 +187,9 @@ script:
pip install $PRE requests==2.9.2 linkchecker
linkchecker build/html/index.html
fi
# Currently disabled because of differece in behaviour
# between `pytest-cov` and `nose-coverage`
#- if [[ $USE_PYTEST == true ]]; then coveralls; fi
- rm -rf $HOME/.cache/matplotlib/tex.cache
- rm -rf $HOME/.cache/matplotlib/test_cache

Expand Down
26 changes: 23 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ environment:
CMD_IN_ENV: "cmd /E:ON /V:ON /C obvci_appveyor_python_build_env.cmd"
# Workaround for https://github.com/conda/conda-build/issues/636
PYTHONIOENCODING: "UTF-8"
TEST_ARGS: --no-pep8
PYTEST_ARGS: -ra --timeout=300 --durations=25 #--cov-report= --cov=lib #-n %NUMBER_OF_PROCESSORS%
USE_PYTEST: no
#PYTHONHASHSEED: 0 # Workaround for pytest-xdist flaky colletion order
# # https://github.com/pytest-dev/pytest/issues/920
# # https://github.com/pytest-dev/pytest/issues/1075

matrix:
# for testing purpose: numpy 1.8 on py2.7, for the rest use 1.10/latest
Expand All @@ -38,6 +44,13 @@ environment:
PYTHON_VERSION: "3.5"
TEST_ALL: "no"
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
- TARGET_ARCH: "x64"
CONDA_PY: "35"
CONDA_NPY: "110"
PYTHON_VERSION: "3.5"
TEST_ALL: "no"
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
USE_PYTEST: yes
- TARGET_ARCH: "x86"
CONDA_PY: "27"
CONDA_NPY: "18"
Expand All @@ -58,7 +71,7 @@ platform:
build: false

init:
- cmd: "ECHO %PYTHON_VERSION% %CONDA_INSTALL_LOCN%"
- cmd: "ECHO %PYTHON_VERSION% PYTEST=%USE_PYTEST% %CONDA_INSTALL_LOCN%"

install:
- cmd: set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
Expand All @@ -82,10 +95,15 @@ install:
# same things as the requirements in ci/conda_recipe/meta.yaml
# if conda-forge gets a new pyqt, it might be nice to install it as well to have more backends
# https://github.com/conda-forge/conda-forge.github.io/issues/157#issuecomment-223536381
- 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
- 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 sphinx
- activate test-environment
- cmd: echo %PYTHON_VERSION% %TARGET_ARCH%
- cmd: IF %PYTHON_VERSION% == 2.7 conda install -q functools32
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
- if x%USE_PYTEST% == xyes conda install -q pytest "pytest-cov>=2.3.1" pytest-timeout #pytest-xdist

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

Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
norecursedirs = .git build ci dist extern release tools unit
norecursedirs = .git build ci dist extern release tools unit venv
0