|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +echo "running test routine with python versions:" |
| 4 | +for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do |
| 5 | + echo " ${version}" |
| 6 | +done |
| 7 | + |
| 8 | +PROGNAME=$(basename $0) |
| 9 | +function error_exit |
| 10 | +{ |
| 11 | + echo -e "${PROGNAME}: ${1:-"Unknown Error"}\n" 1>&2 |
| 12 | + exit 1 |
| 13 | +} |
| 14 | + |
| 15 | +# for each version we want, setup a functional virtual environment |
| 16 | +for version in ${PLOTLY_PYTHON_VERSIONS[@]}; do |
| 17 | + echo Testing Python ${version} |
| 18 | + |
| 19 | + # exporting this variable (in this scope) chooses the python version |
| 20 | + export PYENV_VERSION=${version} |
| 21 | + echo "Using pyenv version $(pyenv version)" |
| 22 | + |
| 23 | + echo "install plotly (ignoring possibly cached versions)" |
| 24 | + pip install -I ${PLOTLY_PACKAGE_ROOT} || |
| 25 | + error_exit "${LINENO}: can't install plotly package from project root" |
| 26 | + |
| 27 | + echo "import plotly to create .plotly dir if DNE" |
| 28 | + python -c 'import plotly' || |
| 29 | + error_exit "${LINENO}: can't import plotly package" |
| 30 | + |
| 31 | +# echo "${HOME}" |
| 32 | +# echo "${PLOTLY_CONFIG_DIR}" |
| 33 | +# |
| 34 | +# # test that it imports when you don't have write permissions |
| 35 | +# sudo chmod -R 444 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" || |
| 36 | +# error_exit "${LINENO}: permissions test 444 on .plotly dir failed" |
| 37 | +# |
| 38 | +# # test that setting write permissions will work for import (and tests) |
| 39 | +# sudo chmod -R 666 ${PLOTLY_CONFIG_DIR} && python -c "import plotly" || |
| 40 | +# error_exit "${LINENO}: permissions test 666 on .plotly dir failed" |
| 41 | + |
| 42 | + echo "running tests for Python ${version} as user '$(whoami)'" |
| 43 | + nosetests -xv plotly/tests --with-coverage --cover-package=plotly || |
| 44 | + error_exit "${LINENO}: test suite failed for Python ${version}" |
| 45 | + mkdir "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" || true |
| 46 | + coverage html -d "${CIRCLE_ARTIFACTS}/${PYENV_VERSION}" \ |
| 47 | + --title=${PYENV_VERSION} |
| 48 | + |
| 49 | +done |
0 commit comments