]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Allow tox to pass more arguments to ostestr command
authorgong yong sheng <gong.yongsheng@99cloud.net>
Mon, 31 Aug 2015 05:03:18 +0000 (13:03 +0800)
committerKevin Benton <blak111@gmail.com>
Tue, 5 Jan 2016 22:53:19 +0000 (14:53 -0800)
Co-Authored-By: Kevin Benton <blak111@gmail.com>
Change-Id: Ie9969e0a5254ab5dd33b287f6d3120362b73edd7
Closes-bug: #1490389

TESTING.rst
tools/ostestr_compat_shim.sh [new file with mode: 0755]
tox.ini

index d29728cf42c1f3ee3967e474156a8dc260273794..f045f0ba173c5ba187fb03c06769f7698071ea57 100644 (file)
@@ -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 (executable)
index 0000000..a483ed1
--- /dev/null
@@ -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 fc5fbbf38ffac873394132e78281524df2a73bee..b6ffe28bee95b2f8e036a46e2a987d0662aed0e4 100644 (file)
--- 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.