tests: make ansible/tests/ run in run_tests.
This commit is contained in:
parent
6dd1001d7a
commit
62f7963da9
27
run_tests
27
run_tests
|
@ -6,15 +6,32 @@ echo '-------------------'
|
||||||
echo
|
echo
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
UNIT2="$(which unit2)"
|
UNIT2="$(which unit2)"
|
||||||
|
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run "${UNIT2}" discover \
|
|
||||||
--start-directory "tests" \
|
# First run overwites coverage output.
|
||||||
--pattern '*_test.py' \
|
[ "$SKIP_MITOGEN" ] || {
|
||||||
"$@"
|
coverage run "${UNIT2}" discover \
|
||||||
|
--start-directory "tests" \
|
||||||
|
--pattern '*_test.py' \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Second run appends. This is since 'discover' treats subdirs as packages and
|
||||||
|
# the 'ansible' subdir shadows the real Ansible package when it contains
|
||||||
|
# __init__.py, so hack around it by just running again with 'ansible' as the
|
||||||
|
# start directory. Alternative seems to be renaming tests/ansible/ and making a
|
||||||
|
# mess of Git history.
|
||||||
|
[ "$SKIP_ANSIBLE" ] || {
|
||||||
|
export PYTHONPATH=`pwd`/tests:$PYTHONPATH
|
||||||
|
coverage run -a "${UNIT2}" discover \
|
||||||
|
--start-directory "tests/ansible" \
|
||||||
|
--pattern '*_test.py' \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
coverage html
|
coverage html
|
||||||
echo coverage report is at "file://$(pwd)/htmlcov/index.html"
|
echo coverage report is at "file://$(pwd)/htmlcov/index.html"
|
||||||
|
|
Loading…
Reference in New Issue