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: I14ae3879465e622f36fd7bba3f04cb6e0cb7500e
This commit is contained in:
Ha Manh Dong 2018-07-19 09:26:02 +07:00
parent e104c6e0bf
commit 1f25711a9b
6 changed files with 17 additions and 15 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.log
.searchlight-venv
.venv
.testrepository/
.stestr/
.tox
.coverage*
cover/*

4
.stestr.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
test_path=./searchlight/tests
top_dir=.

View File

@ -1,8 +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 ./ ./searchlight/tests $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -115,7 +115,7 @@ sphinxcontrib-websupport==1.0.1
statsd==3.2.2
stevedore==1.20.0
tenacity==4.9.0
testrepository==0.0.18
stestr==2.0.0
testtools==2.2.0
traceback2==1.4.0
unittest2==1.1.0

View File

@ -14,7 +14,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
sphinx!=1.6.6,>=1.6.2 # BSD
requests>=2.14.2 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
psutil>=3.2.2 # BSD
reno>=2.5.0 # Apache-2.0

14
tox.ini
View File

@ -10,8 +10,8 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
lockutils-wrapper python setup.py testr --slowest --testr-args='{posargs}'
find . -type f -name "*.pyc" -delete
lockutils-wrapper stestr run --slowest {posargs}
whitelist_externals = bash
find
@ -22,9 +22,15 @@ commands =
[testenv:cover]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
setenv =
VIRTUAL_ENV={envdir}
{[testenv]setenv}
PYTHON=coverage run --source searchlight --parallel-mode
commands =
python setup.py testr --coverage --testr-args='^(?!.*test.*coverage).*$'
stestr run '^(?!.*test.*coverage).*$'
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:venv]