From ce8ffc5303305a56e568206c851cd9e78649be5e Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 7 Sep 2017 15:04:02 -0400 Subject: [PATCH] Set regex flag on ostestr command for osprofiler tests In the unit test tox jobs we run the whole test suite first and after that exits successfully we also run the osprofiler tests while setting an osprofiler env variable to enable osprofiler. However the regex isn't being set properly in ostestr, you set the selection regex with the --regex flag. [1] This only works by chance because ostestr will pass any unrecognized args to the subprocess used to run testr internally, and testr leverages that as a regex. But in the latest os-testr release it doesn't subprocess internally anymore and this doesn't work. This commit fixes things to properly set the regex in ostestr so it works in both old and new versions. The order of the test runs is also switched because we capture the last test run's subunit for openstack-health and other analysis, so we want to full test run to be used for this. [1] https://docs.openstack.org/os-testr/latest/user/ostestr.html#test-selection Change-Id: I890505d65ca6043ddbdcc5895f2620391b505756 --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 4508d35ccc93..869d2edb937f 100644 --- a/tox.ini +++ b/tox.ini @@ -26,14 +26,14 @@ passenv = OS_DEBUG GENERATE_HASHES [testenv:py27] commands = {[testenv]commands} + env TEST_OSPROFILER=1 ostestr --regex 'nova.tests.unit.test_profiler' ostestr '{posargs}' - env TEST_OSPROFILER=1 ostestr 'nova.tests.unit.test_profiler' [testenv:py35] commands = {[testenv]commands} + env TEST_OSPROFILER=1 ostestr --regex 'nova.tests.unit.test_profiler' bash tools/pretty_tox3.sh '{posargs}' - env TEST_OSPROFILER=1 ostestr 'nova.tests.unit.test_profiler' [testenv:pep8] basepython = python2.7