diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100755 index 799ac184..00000000 --- a/tools/pretty_tox.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -TESTRARGS=$1 - -# --until-failure is not compatible with --subunit see: -# -# https://bugs.launchpad.net/testrepository/+bug/1411804 -# -# this work around exists until that is addressed -if [[ "$TESTARGS" =~ "until-failure" ]]; then - python setup.py testr --slowest --testr-args="$TESTRARGS" -else - python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f -fi diff --git a/tools/run_pifpaf.sh b/tools/run_pifpaf.sh new file mode 100755 index 00000000..f7510c32 --- /dev/null +++ b/tools/run_pifpaf.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# This script is used for guaranteeing that `pifpaf` returns non-zero codes +# upon test failure. + +function cleanup { + pifpaf_stop +} + +trap cleanup EXIT + +# Instantiate an ephemeral PostgreSQL DB and print out the `pifpaf` environment +# variables for debugging purposes. +set -ex +eval `pifpaf run postgresql` +env | grep PIFPAF +set +ex + +set -eo pipefail + +TESTRARGS=$1 + +python setup.py testr --slowest --testr-args="--subunit --concurrency=1 $TESTRARGS" | subunit-trace -f diff --git a/tox.ini b/tox.ini index 4e1342e3..edd3f834 100644 --- a/tox.ini +++ b/tox.ini @@ -21,12 +21,12 @@ commands = [testenv:py27] commands = {[testenv]commands} - pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}' + {toxinidir}/tools/run_pifpaf.sh '{posargs}' [testenv:py35] commands = {[testenv]commands} - pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}' + {toxinidir}/tools/run_pifpaf.sh '{posargs}' [testenv:functional] usedevelop = True