From ba3850c60b374bed2dfdaac7a1bfca21aca7fccf Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Mon, 24 Jun 2019 16:26:03 +0900 Subject: [PATCH] Use stestr as a test runner This commit makes to use stestr as a test runner instead of testr. This is aligned to the PTI[0]. [0] https://governance.openstack.org/tc/reference/pti/python.html#python-test-running Change-Id: Iaddccfeea154cef9b711d11eaea2af30987877de --- .gitignore | 3 ++- .stestr.conf | 2 ++ .testr.conf | 7 ------- test-requirements.txt | 5 ++--- tox.ini | 16 +++++++++++++--- 5 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 1399c98..e27830e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,8 @@ pip-log.txt .coverage .tox nosetests.xml -.testrepository +.stestr/ +cover/ # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..4d82673 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,2 @@ +[DEFAULT] +test_path=./bashate/tests \ No newline at end of file diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index fb62267..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 \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt index fb1d5f8..6da24aa 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,7 +12,6 @@ python-subunit>=0.0.18 sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,!=2.1.0;python_version>='3.4' # BSD openstackdocstheme>=1.11.0 # Apache-2.0 -testrepository>=0.0.18 -testscenarios>=0.4 -testtools>=1.4.0 +testtools>=2.2.0 +stestr>=1.0.0 # Apache-2.0 reno!=2.3.1,>=1.8.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 79b4744..63c9a14 100644 --- a/tox.ini +++ b/tox.ini @@ -8,9 +8,11 @@ usedevelop = True install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} +whitelist_externals = * 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] basepython = python3 @@ -25,8 +27,16 @@ basepython = python3 commands = {posargs} [testenv:cover] -basepython = python3 -commands = python setup.py testr --coverage --testr-args='{posargs}' +setenv = + PYTHON=coverage run --source bashate --parallel-mode +commands = + coverage erase + find . -type f -name "*.pyc" -delete + stestr --test-path ./bashate/tests run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:releasenotes] basepython = python3