From ec537c49e9c599127e29dce0702b28fd0fa0a577 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 22 May 2018 09:37:55 -0700 Subject: [PATCH] Switch to stestr According to Openstack summit session [1] stestr is maintained project to which all Openstack projects should migrate. Let's switch it then. [1] https://etherpad.openstack.org/p/YVR-python-pti Change-Id: If3383707c9baf69e03bcccc50970da748a834141 --- .gitignore | 2 +- .testr.conf | 8 -------- lower-constraints.txt | 1 - test-requirements.txt | 2 +- tools/ostestr_compat_shim.sh | 8 -------- tox.ini | 21 ++++++++++++++------- 6 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 .testr.conf delete mode 100755 tools/ostestr_compat_shim.sh diff --git a/.gitignore b/.gitignore index c7935bc1bb5..3536e3d92bc 100644 --- a/.gitignore +++ b/.gitignore @@ -27,8 +27,8 @@ setuptools*.egg/ !/.mailmap !/.pylintrc !/.stestr.conf -!/.testr.conf !/.zuul.yaml +.stestr/ # Files created by releasenotes build releasenotes/build diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index d96d48ed296..00000000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index 1043ecbc19d..65ba26e3c70 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -61,7 +61,6 @@ openstackdocstheme==1.18.1 openstacksdk==0.11.2 os-client-config==1.28.0 os-service-types==1.2.0 -os-testr==1.0.0 os-xenapi==0.3.1 osc-lib==1.8.0 oslo.cache==1.26.0 diff --git a/test-requirements.txt b/test-requirements.txt index 08adabd0915..1308568d6b3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -14,7 +14,7 @@ testresources>=2.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD WebTest>=2.0.27 # MIT oslotest>=3.2.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0 ddt>=1.0.1 # MIT pylint==1.4.5 # GPLv2 diff --git a/tools/ostestr_compat_shim.sh b/tools/ostestr_compat_shim.sh deleted file mode 100755 index 195cbd248b3..00000000000 --- a/tools/ostestr_compat_shim.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/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 5e8b4a9016f..d53ceb9fa61 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,9 @@ skipsdist = True [testenv] setenv = VIRTUAL_ENV={envdir} + OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} + OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} + OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} PYTHONWARNINGS=default::DeprecationWarning passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY usedevelop = True @@ -15,8 +18,7 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt whitelist_externals = sh -commands = - {toxinidir}/tools/ostestr_compat_shim.sh {posargs} +commands = stestr run {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. @@ -61,7 +63,7 @@ deps = {[testenv:functional]deps} commands = {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin - {toxinidir}/tools/ostestr_compat_shim.sh {posargs} + stestr run {posargs} [testenv:dsvm-functional-python35] basepython = python3.5 @@ -70,7 +72,7 @@ deps = {[testenv:dsvm-functional]deps} commands = {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin - {toxinidir}/tools/ostestr_compat_shim.sh {posargs} + stestr run {posargs} [testenv:dsvm-fullstack] setenv = {[testenv]setenv} @@ -84,7 +86,7 @@ deps = commands = {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir} {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin - {toxinidir}/tools/ostestr_compat_shim.sh --concurrency 4 {posargs} + stestr run --concurrency 4 {posargs} [testenv:dsvm-fullstack-python35] basepython = python3.5 @@ -94,7 +96,6 @@ deps = commands = {[testenv:dsvm-fullstack]commands} - [testenv:releasenotes] deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html @@ -121,9 +122,15 @@ whitelist_externals = [testenv:cover] basepython = python2.7 +setenv = + {[testenv]setenv} + PYTHON=coverage run --source neutron --parallel-mode commands = - python setup.py testr --coverage --testr-args='{posargs}' + stestr run --no-subunit-trace {posargs} + coverage combine coverage report --fail-under=82 --skip-covered + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:venv] commands = {posargs}