From 73ef1f549c922759ba6c74f2bb6c0f1a4c72e6c2 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 4 Aug 2017 15:21:38 -0400 Subject: [PATCH] Switch to using stestr stestr is a fork of testrepository, designed specifically to concentrate on being a dedicated test runner. [1] The testrepository project is basically not active anymore and has several long standing bugs and useablility issues. stestr is still actively maintained and fixes a large number of those issues with testrepository. [1] https://github.com/mtreinish/stestr Change-Id: I9b8049fd2c78d8f90aed5a8b35c0a9b40ad8c463 --- .gitignore | 1 + .stestr.conf | 3 ++ .testr.conf | 7 ---- .../tests/functional/hooks/post_test_hook.sh | 2 +- test-requirements.txt | 2 +- tox.ini | 42 ++++++++++--------- 6 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 09132e5f7..1f0139551 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ cover .tox nosetests.xml .testrepository +.stestr # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..d90a44466 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./shade/tests/unit +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 3ce7ec2a9..000000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +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} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./shade/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/shade/tests/functional/hooks/post_test_hook.sh b/shade/tests/functional/hooks/post_test_hook.sh index 6be3fe42c..52037cd38 100755 --- a/shade/tests/functional/hooks/post_test_hook.sh +++ b/shade/tests/functional/hooks/post_test_hook.sh @@ -45,7 +45,7 @@ echo "Running shade functional test suite" set +e sudo -E -H -u jenkins tox -e$tox_env EXIT_CODE=$? -sudo testr last --subunit > $WORKSPACE/tempest.subunit +sudo stestr last --subunit > $WORKSPACE/tempest.subunit .tox/$tox_env/bin/pbr freeze set -e diff --git a/test-requirements.txt b/test-requirements.txt index e7edec71a..f726c02f2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,7 @@ openstackdocstheme>=1.16.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 requests-mock>=1.1.0 # Apache-2.0 sphinx>=1.6.2 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT reno>=2.5.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f6fd3f783..52a9274c1 100644 --- a/tox.ini +++ b/tox.ini @@ -9,31 +9,28 @@ basepython = {env:SHADE_TOX_PYTHON:python2} passenv = UPPER_CONSTRAINTS_FILE install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} setenv = - VIRTUAL_ENV={envdir} - LANG=en_US.UTF-8 - LANGUAGE=en_US:en - LC_ALL=C - BRANCH_NAME=master - CLIENT_NAME=shade + VIRTUAL_ENV={envdir} + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C + BRANCH_NAME=master + CLIENT_NAME=shade deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = stestr run {posargs} + stestr slowest [testenv:functional] -setenv = - {[testenv]setenv} - OS_TEST_PATH = ./shade/tests/functional passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE -commands = python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}' +commands = stestr --test-path ./shade/tests/functional run --serial {posargs} + stestr slowest [testenv:functional-tips] -setenv = - {[testenv]setenv} - OS_TEST_PATH = ./shade/tests/functional passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE whitelist_externals = bash commands = - bash -x {toxinidir}/extras/install-tips.sh - python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}' + bash -x {toxinidir}/extras/install-tips.sh + stestr --test-path ./shade/tests/functional run --serial {posargs} + stestr slowest [testenv:pep8] commands = flake8 shade @@ -44,11 +41,18 @@ commands = {posargs} [testenv:debug] whitelist_externals = find commands = - find . -type f -name "*.pyc" -delete - oslo_debug_helper {posargs} + find . -type f -name "*.pyc" -delete + oslo_debug_helper {posargs} [testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +setenv = + {[testenv]setenv} + PYTHON=coverage run --source shade --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:ansible] # Need to pass some env vars for the Ansible playbooks