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.

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

Change-Id: Ib10e4f3ac8344f5129ce355c093e567fb2b1eba0
This commit is contained in:
Ha Manh Dong 2018-07-17 15:52:56 +07:00
parent a06c7bbb5a
commit 8832627ef8
5 changed files with 13 additions and 11 deletions

2
.gitignore vendored
View File

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

3
.stestr.conf Normal file
View File

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

View File

@ -28,7 +28,7 @@ test =
oslotest>=1.10.0 # Apache-2.0
reno>=1.6.2 # Apache2
tempest>=10
testrepository>=0.0.18
stestr>=2.0.0 # Apache-2.0
testtools>=1.4.0
pifpaf[gnocchi]>=0.23
gnocchi[postgresql,file]

10
tox.ini
View File

@ -16,7 +16,7 @@ passenv = GNOCCHI_* AODH_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE O
deps =
.[test]
http://tarballs.openstack.org/aodh/aodh-master.tar.gz#egg=aodh[mysql]
commands = pifpaf run aodh -- python setup.py test --slowest --testr-args='{posargs}'
commands = pifpaf run aodh -- stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
@ -31,8 +31,14 @@ commands = {posargs}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source aodhclient --parallel-mode
commands =
python setup.py test --coverage --testr-args='{posargs}'
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:releasenotes]