Skip to content

Switch testing to pytest completely #7974

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 14 commits into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stop installing nose in CI.
  • Loading branch information
QuLogic committed Feb 2, 2017
commit c520c2c9a5caf82010ffad667e3f6c5df161711d
29 changes: 12 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ env:
- NPROC=2
- INSTALL_PEP8=
- RUN_PEP8=
- NOSE_ARGS="-n $NPROC"
- PYTEST_ARGS="-ra --maxfail=1 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
- PYTHON_ARGS=
- DELETE_FONT_CACHE=
Expand All @@ -58,7 +57,7 @@ matrix:
- python: 3.4
env: PYTHON_ARGS=-OO
- python: 3.5
env: PANDAS=pandas NOSE_ARGS=--with-coverage DELETE_FONT_CACHE=1
env: PANDAS=pandas DELETE_FONT_CACHE=1
- python: 3.5
env: BUILD_DOCS=true
- python: 3.5
Expand All @@ -70,7 +69,7 @@ matrix:
- os: osx
osx_image: xcode7.3
language: generic # https://github.com/travis-ci/travis-ci/issues/2312
env: MOCK=mock NOSE_ARGS=
env: MOCK=mock
cache:
# As for now travis caches only "$HOME/.cache/pip"
# https://docs.travis-ci.com/user/caching/#pip-cache
Expand Down Expand Up @@ -117,9 +116,6 @@ install:
pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.6 $PANDAS cycler coveralls coverage $MOCK
pip install $PRE -r doc-requirements.txt

# 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 $INSTALL_PEP8

Expand Down Expand Up @@ -155,21 +151,20 @@ script:
if [[ $DELETE_FONT_CACHE == 1 ]]; then
rm -rf ~/.cache/matplotlib
fi
# Workaround for pytest-xdist flaky collection order
# https://github.com/pytest-dev/pytest/issues/920
# https://github.com/pytest-dev/pytest/issues/1075
export PYTHONHASHSEED=$(shuf -i 1-4294967295 -n 1)
echo PYTHONHASHSEED=$PYTHONHASHSEED

echo The following args are passed to pytest $PYTEST_ARGS $RUN_PEP8
if [[ $USE_PYTEST == false ]]; then
echo The following args are passed to nose $NOSE_ARGS $RUN_PEP8
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
python tests.py $NOSE_ARGS $RUN_PEP8
python tests.py $PYTEST_ARGS $RUN_PEP8
else
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $RUN_PEP8
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $PYTEST_ARGS $RUN_PEP8
fi
else
# Workaround for pytest-xdist flaky colletion order
# https://github.com/pytest-dev/pytest/issues/920
# https://github.com/pytest-dev/pytest/issues/1075
export PYTHONHASHSEED=$(shuf -i 1-4294967295 -n 1)
echo PYTHONHASHSEED=$PYTHONHASHSEED

echo The following args are passed to pytest $PYTEST_ARGS $RUN_PEP8
py.test $PYTEST_ARGS $RUN_PEP8
fi
else
Expand Down Expand Up @@ -225,7 +220,7 @@ after_success:
else
echo "Will only deploy docs build from matplotlib master branch"
fi
if [[ $NOSE_ARGS =~ "--with-coverage" || $USE_PYTEST == true ]]; then
if [[ $USE_PYTEST == true ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do this on all runs now?

Copy link
Member Author

@QuLogic QuLogic Feb 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was leaving that to #8003, but I see now it doesn't change this condition. @dopplershift Should I turn on coverage for everything here or just leave it for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and turn it on--I'll rebase on it.

coveralls
bash <(curl -s https://codecov.io/bash)
fi
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ install:
- 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
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
- 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 @@ -135,9 +135,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
- if x%USE_PYTEST% == xyes echo The following args are passed to pytest %PYTEST_ARGS%
- echo The following args are passed to pytest %PYTEST_ARGS%
- if x%USE_PYTEST% == xyes py.test %PYTEST_ARGS%
- if x%USE_PYTEST% == xno python tests.py
- if x%USE_PYTEST% == xno python tests.py %PYTEST_ARGS%
# Generate a html for visual tests
- python visual_tests.py

Expand Down