Switch to use stestr for unit test

According to Openstack summit session [1], stestr is maintained project
to which all Openstack projects should migrate.  So we should switch to
stestr.

This has the side effect of no longer reporting coverage by default for
unit tests. This isn't a big deal given that we have a 'cover' target
for just this purpose.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: I85545c7b4c410c310026911448a7c3847c665afb
This commit is contained in:
Ha Manh Dong 2018-07-20 10:58:40 +07:00 committed by Sean McGinnis
parent 9f866b35a1
commit 29d66751d6
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
6 changed files with 18 additions and 15 deletions

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ pip-log.txt
.coverage* .coverage*
.tox .tox
nosetests.xml nosetests.xml
.testrepository .stestr/
.venv .venv
# Translations # Translations

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./reno/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

@ -1,5 +1,6 @@
Sphinx==1.6.1
docutils==0.11 docutils==0.11
dulwich==0.15.0
PyYAML==3.10.0 PyYAML==3.10.0
six==1.9.0 six==1.9.0
dulwich==0.15.0 Sphinx==1.6.1
stestr==2.0.0

View File

@ -6,9 +6,9 @@ hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0
mock>=1.2 mock>=1.2
coverage>=3.6 coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=0.0.18 python-subunit>=0.0.18
openstackdocstheme>=1.11.0 # Apache-2.0 openstackdocstheme>=1.11.0 # Apache-2.0
testrepository>=0.0.18 stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 testscenarios>=0.4
testtools>=1.4.0 testtools>=1.4.0

12
tox.ini
View File

@ -11,8 +11,7 @@ deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
.[sphinx] .[sphinx]
commands = commands =
python setup.py test --slowest --coverage --coverage-package-name=reno --testr-args='{posargs}' stestr run --slowest {posargs}
coverage report --show-missing
[testenv:pep8] [testenv:pep8]
basepython = python3 basepython = python3
@ -32,7 +31,14 @@ commands = {posargs}
[testenv:cover] [testenv:cover]
basepython = python3 basepython = python3
commands = python setup.py test --coverage --testr-args='{posargs}' setenv =
{[testenv]setenv}
PYTHON=coverage run --source reno --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs] [testenv:docs]
# NOTE(dhellmann): Build our own documentation using the # NOTE(dhellmann): Build our own documentation using the