From 63ddedf69d1d2d90e6da747c9e77ca7255f99429 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 6 Sep 2016 11:20:44 +1000 Subject: [PATCH] Fix error detection in horizon test suite Also, simplify tox environment by reducing repeated definition of the same test command across all of the "test suite" environments. Change-Id: Icbe7558b973dcd1ef50c85cdefc02e165b5bdc7c Closes-Bug: 1620430 --- tox.ini | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tox.ini b/tox.ini index a892010886..bf55ae32ff 100644 --- a/tox.ini +++ b/tox.ini @@ -16,15 +16,18 @@ setenv = deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - -[testenv:py27] whitelist_externals = bash commands = + # Try to detect whether a limited test suite is being specified and if so + # direct the testing to that suite's project; otherwise run the full suite + # in both horizon and openstack_dashboard "projects". bash -c 'project=`echo {posargs} | cut -d. -f1`; \ if [ -z "$project" ]; then \ - {envpython} {toxinidir}/manage.py test horizon --settings=horizon.test.settings {posargs}; \ - {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --exclude-dir=openstack_dashboard/test/integration_tests {posargs}; \ + EXIT_STATUS=0; \ + {envpython} {toxinidir}/manage.py test horizon --settings=horizon.test.settings {posargs} || EXIT_STATUS=$?; \ + {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --exclude-dir=openstack_dashboard/test/integration_tests {posargs} || EXIT_STATUS=$?; \ + exit $EXIT_STATUS; \ else \ {envpython} {toxinidir}/manage.py test {posargs} --settings=$project.test.settings --exclude-dir=openstack_dashboard/test/integration_tests; \ fi' @@ -41,16 +44,6 @@ basepython = python3.4 setenv = {[testenv]setenv} PYTHONUNBUFFERED=1 -whitelist_externals = - bash -commands = - bash -c 'project=`echo {posargs} | cut -d. -f1`; \ - if [ -z "$project" ]; then \ - {envpython} {toxinidir}/manage.py test horizon --settings=horizon.test.settings {posargs}; \ - {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --exclude-dir=openstack_dashboard/test/integration_tests {posargs}; \ - else \ - {envpython} {toxinidir}/manage.py test {posargs} --settings=$project.test.settings --exclude-dir=openstack_dashboard/test/integration_tests; \ - fi' [testenv:pep8] usedevelop = True @@ -64,7 +57,6 @@ commands = {[testenv:extractmessages_check]commands} flake8 - [testenv:extractmessages] usedevelop = True setenv =