From 29d66751d60adeff7023b189b3390fb71f557f07 Mon Sep 17 00:00:00 2001 From: Ha Manh Dong Date: Fri, 20 Jul 2018 10:58:40 +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. This has the side effect of no longer reporting coverage by default for unit tests. This isn't a big deal given that we have a 'cover' target for just this purpose. [1] https://etherpad.openstack.org/p/YVR-python-pti Change-Id: I85545c7b4c410c310026911448a7c3847c665afb --- .gitignore | 2 +- .stestr.conf | 3 +++ .testr.conf | 7 ------- lower-constraints.txt | 5 +++-- test-requirements.txt | 4 ++-- tox.ini | 12 +++++++++--- 6 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 3b982a9..2fda3fe 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ pip-log.txt .coverage* .tox nosetests.xml -.testrepository +.stestr/ .venv # Translations diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..d5816e6 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./reno/tests +top_dir=. diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 6d83b3c..0000000 --- a/.testr.conf +++ /dev/null @@ -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 ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index abff126..b883ff0 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,5 +1,6 @@ -Sphinx==1.6.1 docutils==0.11 +dulwich==0.15.0 PyYAML==3.10.0 six==1.9.0 -dulwich==0.15.0 +Sphinx==1.6.1 +stestr==2.0.0 diff --git a/test-requirements.txt b/test-requirements.txt index 203542f..0acdf9f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,9 +6,9 @@ hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0 mock>=1.2 -coverage>=3.6 +coverage!=4.4,>=4.0 # Apache-2.0 python-subunit>=0.0.18 openstackdocstheme>=1.11.0 # Apache-2.0 -testrepository>=0.0.18 +stestr>=2.0.0 # Apache-2.0 testscenarios>=0.4 testtools>=1.4.0 diff --git a/tox.ini b/tox.ini index d9d5714..1796432 100644 --- a/tox.ini +++ b/tox.ini @@ -11,8 +11,7 @@ deps = -r{toxinidir}/test-requirements.txt .[sphinx] commands = - python setup.py test --slowest --coverage --coverage-package-name=reno --testr-args='{posargs}' - coverage report --show-missing + stestr run --slowest {posargs} [testenv:pep8] basepython = python3 @@ -32,7 +31,14 @@ commands = {posargs} [testenv:cover] basepython = python3 -commands = python setup.py test --coverage --testr-args='{posargs}' +setenv = + {[testenv]setenv} + PYTHON=coverage run --source reno --parallel-mode +commands = + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml [testenv:docs] # NOTE(dhellmann): Build our own documentation using the