blob: 4517afcbc84e69e02375b18dd3e5b7ca875657fd [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
Sergey Shepelev55d87802018-03-17 02:33:19 +030017 case "${test_group-}" in
18 pep8)
Sergey Shepelev0112eff2017-05-05 06:46:43 +030019 if [[ "${TRAVIS_PYTHON_VERSION}" = "2.7" ]] ; then
20 flake8 python2/
21 else
22 flake8 python3/ tests/
23 fi
Sergey Shepelev55d87802018-03-17 02:33:19 +030024 ;;
25 package)
26 # TODO: sdist bdist_wheel
27 # but wheels don't roll well with our 2/3 split code base
28 python setup.py sdist
29 pip install dist/httplib2*
30 ;;
31 *)
Sergey Shepelev0112eff2017-05-05 06:46:43 +030032 pip install -e .
33 httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_303 $@ tests/ || true
34 httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_head_301 $@ tests/ || true
35 pytest --fulltrace ${test_flags[@]}
Sergey Shepelev55d87802018-03-17 02:33:19 +030036 codecov --flags=$(echo $python |tr -d -- '-.')
37 ;;
38 esac
Sergey Shepelev0112eff2017-05-05 06:46:43 +030039else
40 if [[ ! -d ./venv-27 ]] ; then
41 virtualenv --python=python2.7 ./venv-27
42 ./venv-27/bin/pip install -e . -r requirements-test.txt
43 fi
44 if [[ ! -d ./venv-36 ]] ; then
45 virtualenv --python=python3.6 ./venv-36
46 ./venv-36/bin/pip install -e . -r requirements-test.txt
47 fi
Sergey Shepelev55d87802018-03-17 02:33:19 +030048
Sergey Shepelev0112eff2017-05-05 06:46:43 +030049 ./venv-27/bin/pytest ${test_flags[@]}
50 ./venv-36/bin/pytest ${test_flags[@]}
Sergey Shepelev55d87802018-03-17 02:33:19 +030051
Sergey Shepelev0112eff2017-05-05 06:46:43 +030052 # FIXME: too many errors
53 # ./venv-27/bin/flake8 python2/
54 # ./venv-36/bin/flake8 python3/ tests/
Sergey Shepelev55d87802018-03-17 02:33:19 +030055
56 # TODO: sdist bdist_wheel
57 # but wheels don't roll well with our 2/3 split code base
58 ./venv-36/bin/python setup.py sdist
Sergey Shepelev0112eff2017-05-05 06:46:43 +030059fi
60rm -rf ./_httplib2_test_cache