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

Depends-On: https://review.openstack.org/#/c/589728/
Change-Id: I943a73e22eb23bd52c3a96e75c98b88665474e67
This commit is contained in:
Ha Manh Dong 2018-07-20 13:38:36 +07:00 committed by Doug Hellmann
parent 349f79937f
commit a11c88a303
7 changed files with 18 additions and 16 deletions

2
.gitignore vendored
View File

@ -28,7 +28,7 @@ pip-log.txt
nosetests.xml nosetests.xml
.venv .venv
cover cover
.testrepository .stestr/
htmlcov htmlcov
# Translations # Translations

3
.stestr.conf Normal file
View File

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

View File

@ -1,11 +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} \
OS_DEBUG=${OS_DEBUG:-TRACE} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
${PYTHON:-python} -m subunit.run discover -t ./ ./taskflow/tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -70,7 +70,7 @@ SQLAlchemy-Utils==0.30.11
SQLAlchemy==1.0.10 SQLAlchemy==1.0.10
stevedore==1.20.0 stevedore==1.20.0
tenacity==4.4.0 tenacity==4.4.0
testrepository==0.0.18 stestr==2.0.0
testscenarios==0.4 testscenarios==0.4
testtools==2.2.0 testtools==2.2.0
traceback2==1.4.0 traceback2==1.4.0

View File

@ -47,3 +47,6 @@ cachetools>=2.0.0 # MIT License
# For deprecation of things # For deprecation of things
debtcollector>=1.2.0 # Apache-2.0 debtcollector>=1.2.0 # Apache-2.0
# For stestr
stestr>=2.0.0 # Apache-2.0

View File

@ -29,6 +29,6 @@ oslotest>=3.2.0 # Apache-2.0
mock>=2.0.0 # BSD mock>=2.0.0 # BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testrepository>=0.0.18 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD

11
tox.ini
View File

@ -21,7 +21,7 @@ deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
commands = commands =
python setup.py testr --slowest --testr-args='{posargs}' stestr run {posargs}
[testenv:docs] [testenv:docs]
basepython = python3 basepython = python3
@ -56,7 +56,14 @@ basepython = python3
deps = deps =
{[testenv]deps} {[testenv]deps}
coverage>=3.6 coverage>=3.6
commands = python setup.py testr --coverage --testr-args='{posargs}' setenv =
{[testenv]setenv}
PYTHON=coverage run --source taskflow --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:venv] [testenv:venv]
basepython = python3 basepython = python3