Convert from testrepository to stestr

Openstack governance expects unit tests to be run using stestr.

https://governance.openstack.org/tc/reference/pti/python.html
Refer to "Python test running" section

Change-Id: Idc21987803c332a4a3e1afe4653010e4f9369e90
Story: 2004515
Task: 37745
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2019-11-25 13:58:48 -06:00
parent 28b3bd8ba2
commit 95d1fcc7c5
5 changed files with 32 additions and 21 deletions

View File

@ -1,3 +1,4 @@
.stestr
.testrepository
coverage.xml
.coverage

View File

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

View File

@ -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:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./cgtsclient/tests} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
# group tests when running concurrently
# This regex groups by classname
#group_regex=([^\.]+\.)+

View File

@ -8,13 +8,11 @@ bandit>=1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0 # BSD
os-testr>=0.8.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
sphinx>=1.6.2 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
stestr
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
testresources>=0.2.4 # Apache-2.0/BSD
tempest>=16.1.0 # Apache-2.0
httplib2
python-keystoneclient

View File

@ -25,7 +25,6 @@ deps = -r{toxinidir}/requirements.txt
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
python setup.py testr --slowest --testr-args='{posargs}'
whitelist_externals =
bash
@ -33,6 +32,20 @@ whitelist_externals =
rm
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:py27]
basepython = python2.7
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
deps = -r{toxinidir}/test-requirements.txt
commands =
@ -43,14 +56,20 @@ commands = {posargs}
[testenv:cover]
basepython = python2.7
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
find . -type f -name ".coverage\.*" -delete
rm -f .coverage
rm -Rf cover
rm -f coverage.xml
python setup.py testr --coverage --testr-args='{posargs}'
coverage xml
coverage report
{[testenv]commands}
coverage erase
rm -f .coverage
rm -Rf cover
rm -f coverage.xml
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[flake8]
show-source = true