From 83db537dc68716954d25cf528bb076381563afa1 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 7 Jun 2018 14:39:50 +0200 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: Ia4c71631e4c51ec814bcefc115d4f5690c11e37b --- .gitignore | 1 - .testr.conf | 4 ---- lower-constraints.txt | 1 - test-requirements.txt | 2 +- tools/ostestr_compat_shim.sh | 8 -------- tox.ini | 20 +++++++++++++++----- 6 files changed, 16 insertions(+), 20 deletions(-) delete mode 100644 .testr.conf delete mode 100755 tools/ostestr_compat_shim.sh diff --git a/.gitignore b/.gitignore index 3b667ce67..9e465e3cc 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,6 @@ subunit.log !/.gitreview !/.mailmap !/.pylintrc -!/.testr.conf !/.stestr.conf # Files created by releasenotes build diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 70b32c302..000000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron_vpnaas/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 d43377dc7..9df261222 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -60,7 +60,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 dd831c330..a102f13b4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -20,4 +20,4 @@ WebOb>=1.7.1 # MIT WebTest>=2.0.27 # MIT oslotest>=3.2.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 diff --git a/tools/ostestr_compat_shim.sh b/tools/ostestr_compat_shim.sh deleted file mode 100755 index a483ed1a1..000000000 --- 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 01136f5aa..2f98541a6 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 usedevelop = True deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} @@ -12,8 +15,8 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/re -r{toxinidir}/test-requirements.txt whitelist_externals = sh commands = - {toxinidir}/tools/ostestr_compat_shim.sh {posargs} -# there is also secret magic in ostestr which lets you run in a fail only + stestr run {posargs} +# there is also secret magic in stestr which lets you run in a fail only # mode. To do this define the TRACE_FAILONLY environmental variable. [testenv:functional] @@ -39,7 +42,7 @@ sitepackages=True whitelist_externals = {[testenv:functional]whitelist_externals} commands = {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir} - ostestr '{posargs}' + stestr run {posargs} [testenv:dsvm-functional-sswan] setenv = @@ -50,7 +53,7 @@ sitepackages=True whitelist_externals = {[testenv:functional]whitelist_externals} commands = {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir} - ostestr '{posargs}' + stestr run {posargs} [testenv:releasenotes] commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html @@ -68,8 +71,15 @@ whitelist_externals = sh commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py [testenv:cover] +setenv = + {[testenv]setenv} + PYTHON=coverage run --source neutron_vpnaas --parallel-mode commands = - python setup.py test --coverage --coverage-package-name=neutron_vpnaas --testr-args='{posargs}' + stestr run --no-subunit-trace {posargs} + coverage combine + coverage report --skip-covered + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:venv] commands = {posargs}