From 42379399a2e6f957eeb61cc343f42328ef8d30a1 Mon Sep 17 00:00:00 2001 From: Ha Manh Dong Date: Tue, 17 Jul 2018 14:28:12 +0700 Subject: [PATCH] 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: Iee13deb54056e1c81d3732cb51a61c68481607fa --- .gitignore | 2 +- .stestr.conf | 3 +++ .testr.conf | 4 ---- test-requirements.txt | 2 +- tox.ini | 11 +++++++++-- 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index efde447..ec8cee7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ build cover htmlcov .secret_key_store -.testrepository +.stestr/ .venv dist *.egg diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..a32c660 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./cloudkittydashboard/tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index f8ada83..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=${PYTHON:-python} -m subunit.run discover -t ./ ./cloudkittydashboard/tests $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/test-requirements.txt b/test-requirements.txt index 2fe8929..2b3b23f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,7 +9,7 @@ python-subunit>=0.0.18 sphinx>=1.6.2 # BSD openstackdocstheme>=1.11.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 -testrepository>=0.0.18 +stestr>=2.0.0 # Apache-2.0 testscenarios>=0.4 testtools>=1.4.0 reno>=1.8.0 # Apache2 diff --git a/tox.ini b/tox.ini index c293c28..99ea147 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = stestr run --slowest {posargs} [testenv:pep8] commands = flake8 @@ -19,7 +19,14 @@ commands = flake8 commands = {posargs} [testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +setenv = + {[testenv]setenv} + PYTHON=coverage run --source cloudkittydashboard --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:docs] commands = python setup.py build_sphinx