Sergey Shepelev | 0112eff | 2017-05-05 06:46:43 +0300 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | set -eux |
| 3 | # By default, run tests with pytest-forked plugin, |
| 4 | # disable in terminal for debugging, you may add --forked |
| 5 | flag_forked="--forked" |
| 6 | if [[ -z "${CONTINUOUS_INTEGRATION-}" ]] && [[ -t 1 ]] ; then |
| 7 | flag_forked="" |
| 8 | fi |
| 9 | test_flags=( |
| 10 | $@ |
| 11 | $flag_forked |
| 12 | tests/ |
| 13 | ) |
| 14 | |
| 15 | cd "$( dirname "${BASH_SOURCE[0]}" )/.." |
| 16 | if [[ -n "${CONTINUOUS_INTEGRATION-}" ]] ; then |
| 17 | if [[ "${test_group-}" = "pep8" ]] ; then |
| 18 | if [[ "${TRAVIS_PYTHON_VERSION}" = "2.7" ]] ; then |
| 19 | flake8 python2/ |
| 20 | else |
| 21 | flake8 python3/ tests/ |
| 22 | fi |
| 23 | else |
| 24 | pip install -e . |
| 25 | httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_303 $@ tests/ || true |
| 26 | httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_head_301 $@ tests/ || true |
| 27 | pytest --fulltrace ${test_flags[@]} |
| 28 | fi |
| 29 | codecov --flags=$(echo $python |tr -d -- '-.') |
| 30 | else |
| 31 | if [[ ! -d ./venv-27 ]] ; then |
| 32 | virtualenv --python=python2.7 ./venv-27 |
| 33 | ./venv-27/bin/pip install -e . -r requirements-test.txt |
| 34 | fi |
| 35 | if [[ ! -d ./venv-36 ]] ; then |
| 36 | virtualenv --python=python3.6 ./venv-36 |
| 37 | ./venv-36/bin/pip install -e . -r requirements-test.txt |
| 38 | fi |
| 39 | ./venv-27/bin/pytest ${test_flags[@]} |
| 40 | ./venv-36/bin/pytest ${test_flags[@]} |
| 41 | # FIXME: too many errors |
| 42 | # ./venv-27/bin/flake8 python2/ |
| 43 | # ./venv-36/bin/flake8 python3/ tests/ |
| 44 | fi |
| 45 | rm -rf ./_httplib2_test_cache |