From 456db8176536a7678e3ed86b6bfa76284699fa55 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 20 Feb 2015 20:35:01 -0500 Subject: [PATCH] Use subunit-trace to enable output during unit test runs This commit adds the pretty_tox.sh script and the usage of subunit-trace to the cinder unit test jobs. This also updates the run_tests.sh script to use subunit-trace so it'll have consistent output formatting with the tox job. Change-Id: I8ceafb476dc488b388c7f63501ef48128d8383d2 --- run_tests.sh | 9 +-------- test-requirements.txt | 1 + tools/pretty_tox.sh | 16 ++++++++++++++++ tox.ini | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100755 tools/pretty_tox.sh diff --git a/run_tests.sh b/run_tests.sh index 6956d3d5a..09e22e8f2 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -150,14 +150,7 @@ function run_tests { ${wrapper} python setup.py egg_info fi echo "Running \`${wrapper} $TESTRTESTS\`" - if ${wrapper} which subunit-2to1 2>&1 > /dev/null - then - # subunit-2to1 is present, testr subunit stream should be in version 2 - # format. Convert to version one before colorizing. - bash -c "${wrapper} $TESTRTESTS | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py" - else - bash -c "${wrapper} $TESTRTESTS | ${wrapper} tools/colorizer.py" - fi + bash -c "${wrapper} $TESTRTESTS | ${wrapper} subunit-trace" RESULT=$? set -e diff --git a/test-requirements.txt b/test-requirements.txt index 2815ec8fa..ef4878be7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -17,3 +17,4 @@ python-subunit>=0.0.18 testtools>=0.9.36,!=1.2.0 testrepository>=0.0.18 oslosphinx>=2.2.0 # Apache-2.0 +tempest-lib>=0.2.0 diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh new file mode 100755 index 000000000..c6ed23bac --- /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 test --no-parallel --slowest --testr-args="$TESTRARGS" +else + python setup.py test --no-parallel --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f +fi diff --git a/tox.ini b/tox.ini index c3589faf3..b6fbcc754 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ install_command = pip install {opts} {packages} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - python setup.py testr --slowest --testr-args='--concurrency 1 {posargs}' + bash tools/pretty_tox.sh '{posargs}' whitelist_externals = bash [tox:jenkins] -- 2.45.2