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
This commit is contained in:
Matthew Treinish 2017-08-04 15:21:38 -04:00 committed by Monty Taylor
parent e239dcd66b
commit 73ef1f549c
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
6 changed files with 29 additions and 28 deletions

1
.gitignore vendored
View File

@ -28,6 +28,7 @@ cover
.tox .tox
nosetests.xml nosetests.xml
.testrepository .testrepository
.stestr
# Translations # Translations
*.mo *.mo

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./shade/tests/unit
top_dir=./

View File

@ -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

View File

@ -45,7 +45,7 @@ echo "Running shade functional test suite"
set +e set +e
sudo -E -H -u jenkins tox -e$tox_env sudo -E -H -u jenkins tox -e$tox_env
EXIT_CODE=$? EXIT_CODE=$?
sudo testr last --subunit > $WORKSPACE/tempest.subunit sudo stestr last --subunit > $WORKSPACE/tempest.subunit
.tox/$tox_env/bin/pbr freeze .tox/$tox_env/bin/pbr freeze
set -e set -e

View File

@ -11,7 +11,7 @@ openstackdocstheme>=1.16.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0
requests-mock>=1.1.0 # Apache-2.0 requests-mock>=1.1.0 # Apache-2.0
sphinx>=1.6.2 # BSD 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 testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
reno>=2.5.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0

42
tox.ini
View File

@ -9,31 +9,28 @@ basepython = {env:SHADE_TOX_PYTHON:python2}
passenv = UPPER_CONSTRAINTS_FILE 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} 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 = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8 LANG=en_US.UTF-8
LANGUAGE=en_US:en LANGUAGE=en_US:en
LC_ALL=C LC_ALL=C
BRANCH_NAME=master BRANCH_NAME=master
CLIENT_NAME=shade CLIENT_NAME=shade
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}' commands = stestr run {posargs}
stestr slowest
[testenv:functional] [testenv:functional]
setenv =
{[testenv]setenv}
OS_TEST_PATH = ./shade/tests/functional
passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE 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] [testenv:functional-tips]
setenv =
{[testenv]setenv}
OS_TEST_PATH = ./shade/tests/functional
passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE passenv = OS_* SHADE_* UPPER_CONSTRAINTS_FILE
whitelist_externals = bash whitelist_externals = bash
commands = commands =
bash -x {toxinidir}/extras/install-tips.sh bash -x {toxinidir}/extras/install-tips.sh
python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}' stestr --test-path ./shade/tests/functional run --serial {posargs}
stestr slowest
[testenv:pep8] [testenv:pep8]
commands = flake8 shade commands = flake8 shade
@ -44,11 +41,18 @@ commands = {posargs}
[testenv:debug] [testenv:debug]
whitelist_externals = find whitelist_externals = find
commands = commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
oslo_debug_helper {posargs} oslo_debug_helper {posargs}
[testenv:cover] [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] [testenv:ansible]
# Need to pass some env vars for the Ansible playbooks # Need to pass some env vars for the Ansible playbooks