]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use subunit-trace to enable output during unit test runs
authorMatthew Treinish <mtreinish@kortar.org>
Sat, 21 Feb 2015 01:35:01 +0000 (20:35 -0500)
committerMatthew Treinish <mtreinish@kortar.org>
Mon, 23 Feb 2015 15:27:16 +0000 (10:27 -0500)
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
test-requirements.txt
tools/pretty_tox.sh [new file with mode: 0755]
tox.ini

index 6956d3d5a2be4c915b8712dde0c4e676c2a48d1f..09e22e8f285752b709873f07e3c3942eddd0d848 100755 (executable)
@@ -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
 
index 2815ec8fa0820f13d2f1ee7bcdbf5e590d2c5258..ef4878be744e427d26440e52aea6dc4a8e3322e9 100644 (file)
@@ -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 (executable)
index 0000000..c6ed23b
--- /dev/null
@@ -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 c3589faf373dc8f356f872348eb2cfdb43689940..b6fbcc75469a8c092ad202e620a1a5c9c0b695cb 100644 (file)
--- 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]