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: I1f8211fd9e3a5327f8c78e548c06b06ac94eb555
This commit is contained in:
Ha Manh Dong 2018-07-20 13:58:43 +07:00
parent bb405dbda4
commit e866bcee9d
5 changed files with 14 additions and 11 deletions

2
.gitignore vendored
View File

@ -46,7 +46,7 @@ tests/functional/.ipynb_checkpoints/
.coverage
.tox
nosetests.xml
.testrepository
.stestr/
.venv
# Translations

3
.stestr.conf Normal file
View File

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

View File

@ -11,7 +11,7 @@ python-subunit>=0.0.18
sphinx>=1.6.2 # BSD
openstackdocstheme>=1.11.0 # Apache-2.0
oslotest>=1.2.0 # Apache-2.0
testrepository>=0.0.18
stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4
testtools>=0.9.36,!=1.2.0
python-swiftclient>=3.1.0

11
tox.ini
View File

@ -17,7 +17,7 @@ deps =
commands =
find . -type f -name "*.py[c|o]" -delete
find . -type d -name "__pycache__" -delete
python setup.py testr --slowest --testr-args='--concurrency 1 {posargs:tests.unit}'
stestr run --slowest --concurrency 1 {posargs:tests.unit}
whitelist_externals = bash
find
@ -58,7 +58,14 @@ commands = {posargs}
[testenv:cover]
basepython = python3
commands = python setup.py testr --coverage --testr-args='{posargs}'
setenv =
{[testenv]setenv}
PYTHON=coverage run --source storlets --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
basepython = python2.7