From 5915585cd2b8bdef96c6fad30a7717fbf42d65ae Mon Sep 17 00:00:00 2001 From: Nguyen Hai Date: Thu, 7 Jun 2018 17:05:17 +0900 Subject: [PATCH] Switch to using stestr stestr is maintained project to which all Openstack projects should migrate. [1] https://etherpad.openstack.org/p/YVR-python-pti [2] https://governance.openstack.org/tc/reference/pti/python.html Change-Id: I3a4a8e6a7c856446686252d80046532e08d3936b --- .stestr.conf | 3 +++ .testr.conf | 4 ---- lower-constraints.txt | 2 -- test-requirements.txt | 3 +-- tools/ostestr_compat_shim.sh | 8 -------- tox.ini | 22 +++++++++++----------- 6 files changed, 15 insertions(+), 27 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf delete mode 100755 tools/ostestr_compat_shim.sh diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..d5330e145 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./tacker/tests/unit +top_path=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 46000f87a..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:-./tacker/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 0bccdf4fd..766a18015 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -65,7 +65,6 @@ openstacksdk==0.12.0 os-api-ref==1.5.0 os-client-config==1.29.0 os-service-types==1.2.0 -os-testr==1.0.0 osc-lib==1.10.0 oslo.cache==1.29.0 oslo.concurrency==3.26.0 @@ -143,7 +142,6 @@ stevedore==1.20.0 tempest==17.1.0 Tempita==0.5.2 tenacity==4.9.0 -testrepository==0.0.18 testresources==2.0.1 testscenarios==0.5.0 testtools==2.2.0 diff --git a/test-requirements.txt b/test-requirements.txt index ddce0e14a..35662073b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,9 +12,8 @@ mock>=2.0.0 # BSD python-subunit>=1.0.0 # Apache-2.0/BSD python-tackerclient>=0.8.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 -os-testr>=1.0.0 # Apache-2.0 +stestr>=2.0.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD testtools>=2.2.0 # MIT WebTest>=2.0.27 # MIT python-barbicanclient>=4.5.2 # 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 5d86fa8ba..c683ba467 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,9 @@ skipsdist = True [testenv] basepython = {env:TACKER_TOX_PYTHON:python2} 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} passenv = UPPER_CONSTRAINTS_FILE usedevelop = True whitelist_externals = rm @@ -14,8 +17,7 @@ install_command = deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = - rm -f .testrepository/times.dbm - {toxinidir}/tools/ostestr_compat_shim.sh {posargs} + stestr run --slowest {posargs} [testenv:functional] setenv = OS_TEST_PATH=./tacker/tests/functional @@ -29,7 +31,7 @@ setenv = {[testenv]setenv} deps = {[testenv:functional]deps} commands = - {toxinidir}/tools/ostestr_compat_shim.sh --concurrency 2 {posargs} + stestr run --slowest --concurrency 2 {posargs} [testenv:debug] commands = oslo_debug_helper {posargs} @@ -62,8 +64,6 @@ commands = sphinx-build -W -b html doc/source doc/build/html [testenv:api-ref] -# This environment is called from CI scripts to test and publish -# the API Ref to developer.openstack.org. deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build @@ -75,14 +75,14 @@ deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html - [testenv:cover] -# Also do not run test_coverage_ext tests while gathering coverage as those -# tests conflict with coverage. +setenv = + PYTHON=coverage run --source tacker --parallel-mode commands = - coverage erase - python setup.py testr --coverage --testr-args='{posargs}' - coverage report + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:venv] commands = {posargs}