blob: a88318bef5c0be7899adb2cd7c407f205bf6a0e6 [file] [log] [blame]
Sergey Shepelev0112eff2017-05-05 06:46:43 +03001#!/bin/bash
2set -eux
3# By default, run tests with pytest-forked plugin,
4# disable in terminal for debugging, you may add --forked
5flag_forked="--forked"
6if [[ -z "${CONTINUOUS_INTEGRATION-}" ]] && [[ -t 1 ]] ; then
7 flag_forked=""
8fi
9test_flags=(
10 $@
11 $flag_forked
12 tests/
13)
14
15cd "$( dirname "${BASH_SOURCE[0]}" )/.."
16if [[ -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 -- '-.')
30else
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/
44fi
45rm -rf ./_httplib2_test_cache