From 02b5c9f0d055a2ba347de26a143a044a0317529e Mon Sep 17 00:00:00 2001 From: "Kyle L. Henderson" Date: Mon, 8 Feb 2016 08:25:51 -0600 Subject: [PATCH] Port over pretty_tox.sh from Nova Nova has a bash script that uses the ostestr package to format the output from tox in a 'pretty' format. It makes it much more readable. pretty_tox.sh is pulled from Nova as-is and enabled in tox.ini. Change-Id: Ib90791b1333044c98e20444953d7ccab21cd62ba --- test-requirements.txt | 1 + tools/pretty_tox.sh | 16 ++++++++++++++++ tox.ini | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 tools/pretty_tox.sh diff --git a/test-requirements.txt b/test-requirements.txt index fa150f7c..db1748a7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,6 +8,7 @@ python-subunit sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 oslosphinx>=2.5.0 # Apache-2.0 oslotest>=1.5.1 # Apache-2.0 +os-testr>=0.4.1 # Apache-2.0 testrepository>=0.0.18 testscenarios>=0.4 testtools>=1.4.0 diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh new file mode 100755 index 00000000..799ac184 --- /dev/null +++ b/tools/pretty_tox.sh @@ -0,0 +1,16 @@ +#!/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/tox.ini b/tox.ini index 6ee93c9b..6ce4b829 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,8 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -egit+https://github.com/openstack/nova#egg=nova -egit+https://github.com/powervm/pypowervm@develop#egg=pypowervm -commands = python setup.py testr --slowest --testr-args='{posargs}' +whitelist_externals = bash +commands = bash tools/pretty_tox.sh '{posargs}' [testenv:pep8] commands = flake8