Skip to content

Commit

Permalink
Run test suite on Travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Jul 22, 2018
1 parent b0c70be commit c36ba30
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
31 changes: 26 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install: |
export CPPFLAGS=-L/usr/local/opt/llvm/include
export LDFLAGS='-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib'
export CC='ccache clang'
export CXX='ccache clang' # Needed due to weird manipulations by distutils.
export CXX='ccache clang' # Due to weird manipulations by distutils.
pip install . &&
pip uninstall -y mplcairo && # Just get the dependencies.
python setup.py bdist_wheel &&
Expand All @@ -54,24 +54,45 @@ install: |
pip install dist/*.whl
;;
esac
# sphinx is needed to make test_tinypages pass on mpl 2.2.2.
pip install -U pytest sphinx
# Install test data.
(
cd "$(mktemp -d)"
mplver="$(python -c 'import matplotlib as mpl; print(mpl.__version__)')"
curl -L https://github.com/matplotlib/matplotlib/archive/v"$mplver".tar.gz |
tar -xz
cd *
for package in matplotlib mpl_toolkits; do
cp -r "lib/$package/tests" \
"$(python -c "import $package; print(list($package.__path__)[0])")"
done
)
# end-syntax: sh
script: |
# begin-syntax: sh
MPLBACKEND=module://mplcairo.base python - <<EOF
case "$TRAVIS_OS_NAME" in
linux)
./run-mpl-test-suite.py --tolerance=50
;;
osx)
MPLBACKEND=module://mplcairo.base python - <<EOF
import sys
if sys.platform == "darwin":
import mplcairo # Apparently needed to get the correct libc++.
import mplcairo # Apparently needed to get the correct libc++.
from pylab import *
gca()
savefig("/dev/null", format="png")
EOF
;;
esac
# end-syntax: sh
after_success: |
# begin-syntax: sh
if [[ "$TRAVIS_OS_NAME" = osx ]]; then
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
brew install \
https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
fi
echo "$KNOWN_HOST" >>~/.ssh/known_hosts
sshpass -e scp -rq dist $DEPLOY:wheels || echo 'Failed to deploy wheels.'
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ Keep in mind that conda-forge's cairo is (on my setup) ~2× slower than a
Test suite
==========

Run ``run-mpl-test-suite.py`` to run the Matplotlib test suite with the
Agg backend patched by the mplcairo backend. Note that Matplotlib must be
installed with its test data, which is not the case when it is installed from
conda or from most Linux distributions; instead, it should be installed from
PyPI or from source.
Run ``run-mpl-test-suite.py`` (which depends on ``pytest>=3.2.2``) to run the
Matplotlib test suite with the Agg backend patched by the mplcairo backend.
Note that Matplotlib must be installed with its test data, which is not the
case when it is installed from conda or from most Linux distributions; instead,
it should be installed from PyPI or from source.

Nearly all image comparison tests "fail" as the renderers are fundamentally
different; currently, the intent is to manually check the diff images. Passing
Expand Down
3 changes: 2 additions & 1 deletion run-mpl-test-suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import sys
import warnings

import mplcairo.base # Need to come before matplotlib import on OSX.

import matplotlib as mpl
import matplotlib.backends.backend_agg
import matplotlib.testing.decorators
import mplcairo.base

import pytest

Expand Down

0 comments on commit c36ba30

Please sign in to comment.