Move to stestr

Follows nova's lead in moving from os-testr to stestr.

Change-Id: I048165d659d9cb194ee27072729076647dfc0710
This commit is contained in:
Matthew Edmonds 2018-06-29 17:44:41 -04:00
parent 124e52062a
commit 4db7cda136
6 changed files with 44 additions and 29 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
build/*
.testrepository
.stestr/
.tox/
nova_powervm.egg-info/
*.pyc

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./nova_powervm/tests
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 ./ . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -8,8 +8,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
python-subunit>=1.0.0 # Apache-2.0/BSD
python-swiftclient>=3.2.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=1.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
mock>=2.0.0 # BSD

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -o pipefail
TESTRARGS=$1
# --until-failure is not compatible with --subunit see:
#
# https://bugs.launchpad.net/testrepository/+bug/1411804
#
# this work around exists until that is addressed
if [[ "$TESTARGS" =~ "until-failure" ]]; then
python setup.py testr --slowest --testr-args="$TESTRARGS"
else
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f
fi

42
tox.ini
View File

@ -7,7 +7,12 @@ skipsdist = True
usedevelop = True
install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
VIRTUAL_ENV={envdir}
LANGUAGE=en_US
LC_ALL=en_US.utf-8
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
@ -15,7 +20,24 @@ deps =
-egit+https://git.openstack.org/openstack/nova#egg=nova
-rhttps://git.openstack.org/cgit/openstack/nova/plain/test-requirements.txt
whitelist_externals = bash
commands = bash tools/pretty_tox.sh '{posargs}'
commands =
find . -type f -name "*.pyc" -delete
[testenv:py27]
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python2.7
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py35]
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python3.5
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
basepython = python3
@ -27,7 +49,21 @@ commands = {posargs}
[testenv:cover]
basepython = python3
commands = python setup.py testr --coverage --testr-args='{posargs}'
# TODO(stephenfin): Remove the PYTHON hack below in favour of a [coverage]
# section once we rely on coverage 4.3+
#
# https://bitbucket.org/ned/coveragepy/issues/519/
setenv =
{[testenv]setenv}
PYTHON=coverage run --source nova --parallel-mode
commands =
{[testenv]commands}
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs]
basepython = python3