diff --git a/bin/test b/bin/test index abb5dafea8c9a5e3bdc2626d7367f018b16263d3..6ccb7df1a6c1b4698b79ab1b9f1efdf54f7d051f 100755 --- a/bin/test +++ b/bin/test @@ -18,6 +18,14 @@ MANAGE_FILE=${MANAGE_FILE:-fakepath} #sp-grep -s django && DJANGO_INSTALLED=1 DJANGO_INSTALLED=1 +coverage=$(which coverage 2> /dev/null) +if [ -x "${coverage}" ] +then + test_cmd=${coverage} +else + test_cmd=python +fi + if [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALLED" ]; then set +e @@ -38,7 +46,7 @@ if [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALLED" ]; then python "$MANAGE_FILE" dbshell <<EOF 2>&1 | tee "$TEST_LOG" CREATE ROLE postgres SUPERUSER; EOF - python "$MANAGE_FILE" test 2>&1 | tee "$TEST_LOG" + ${test_cmd} "$MANAGE_FILE" test 2>&1 | tee "$TEST_LOG" TEST_STATUS="${PIPESTATUS[0]}" set -e @@ -53,6 +61,10 @@ EOF exit 1 } + if [ -x "${coverage}" ] + then + ${coverage} report 2>&1 | tee "$TEST_LOG" + fi echo else exit 1