From 240facf9e67aa5b205679f397107abfe059a869a Mon Sep 17 00:00:00 2001 From: gong yong sheng Date: Mon, 31 Aug 2015 13:03:18 +0800 Subject: [PATCH] Allow tox to pass more arguments to ostestr command Co-Authored-By: Kevin Benton Change-Id: Ie9969e0a5254ab5dd33b287f6d3120362b73edd7 Closes-bug: #1490389 --- TESTING.rst | 4 ++++ tools/ostestr_compat_shim.sh | 8 ++++++++ tox.ini | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 tools/ostestr_compat_shim.sh diff --git a/TESTING.rst b/TESTING.rst index d29728cf42c..f045f0ba173 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -298,6 +298,10 @@ or:: $ tox -e py27 neutron.tests.unit.test_manager.NeutronManagerTestCase $ tox -e py27 neutron.tests.unit.test_manager.NeutronManagerTestCase.test_service_plugin_is_loaded +If you want to pass other arguments to ostestr, you can do the following:: + $ tox -e -epy27 -- --regex neutron.tests.unit.test_manager --serial + + Coverage -------- diff --git a/tools/ostestr_compat_shim.sh b/tools/ostestr_compat_shim.sh new file mode 100755 index 00000000000..a483ed1a1ef --- /dev/null +++ b/tools/ostestr_compat_shim.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# preserve old behavior of using an arg as a regex when '--' is not present +case $@ in + (*--*) ostestr $@;; + ('') ostestr;; + (*) ostestr --regex "$@" +esac diff --git a/tox.ini b/tox.ini index fc5fbbf38ff..b6ffe28bee9 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ deps = -r{toxinidir}/requirements.txt whitelist_externals = sh commands = dsvm-functional: {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin - ostestr --regex '{posargs}' + {toxinidir}/tools/ostestr_compat_shim.sh {posargs} # there is also secret magic in ostestr which lets you run in a fail only # mode. To do this define the TRACE_FAILONLY environmental variable.