From 93a8b15840c945a497eb886a16e2dbdd88e76f59 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 7 Jun 2018 13:18:23 +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: I9fd237292f7da50e60da398b1649001bf1829c66 --- .gitignore | 1 - .testr.conf | 10 ---------- lower-constraints.txt | 1 - test-requirements.txt | 2 +- tools/ostestr_compat_shim.sh | 8 -------- tox.ini | 23 +++++++++++++++++------ 6 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 .testr.conf delete mode 100755 tools/ostestr_compat_shim.sh diff --git a/.gitignore b/.gitignore index 5df790b0..df6c3eb7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ subunit.log !/.mailmap !/.pylintrc !/.stestr.conf -!/.testr.conf !/.zuul.yaml # Files created by releasenotes build diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index c97b02af..00000000 --- a/.testr.conf +++ /dev/null @@ -1,10 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - OS_LOG_CAPTURE=1 \ - ${PYTHON:-python} -m subunit.run discover -t ./ \ - ${OS_TEST_PATH:-./neutron_dynamic_routing/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 99a1c546..3c54e3a7 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -58,7 +58,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 9205ba46..e24f784d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ python-subunit>=1.0.0 # Apache-2.0/BSD sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD openstackdocstheme>=1.18.1 # Apache-2.0 oslo.concurrency>=3.25.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +stestr>=1.0.0 # Apache-2.0 testresources>=2.0.0 # Apache-2.0/BSD testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD diff --git a/tools/ostestr_compat_shim.sh b/tools/ostestr_compat_shim.sh deleted file mode 100755 index a483ed1a..00000000 --- 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 eb1dd09f..a1f375cd 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 install_command =pip install {opts} {packages} @@ -17,14 +20,15 @@ whitelist_externals = commands = find . -type f -name "*.py[c|o]" -delete find . -type d -name "__pycache__" -delete - ostestr '{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] setenv = OS_TEST_PATH=./neutron_dynamic_routing/tests/functional commands = - ostestr --slowest '{posargs}' + stestr run {posargs} + stestr slowest [testenv:api] sitepackages=True @@ -33,7 +37,8 @@ setenv = OS_TESTR_CONCURRENCY=1 TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc} commands = - ostestr --slowest '{posargs}' + stestr run {posargs} + stestr slowest [testenv:dsvm-functional] setenv = @@ -47,7 +52,7 @@ whitelist_externals = cp sudo commands = - ostestr '{posargs}' + stestr run {posargs} [testenv:releasenotes] commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html @@ -59,8 +64,14 @@ commands = {[testenv:genconfig]commands} [testenv:cover] +setenv = + {[testenv]setenv} + PYTHON=coverage run --source neutron_dynamic_routing --parallel-mode commands = - python setup.py test --coverage --coverage-package-name=neutron_dynamic_routing --testr-args='{posargs}' + stestr run --no-subunit-trace {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:venv] commands = {posargs}