From 27c426a76fd9ea0169ed9026a9562a230f646269 Mon Sep 17 00:00:00 2001 From: Anand Bhat Date: Thu, 24 Jun 2021 17:52:47 +0530 Subject: [PATCH] Migrate from testr to stestr * Replace .testr.conf by .stestr.conf for migration and update .gitignore, test-requirements.txt and lower-constraints.txt files accordingly * Use py3 as the default runtime for tox and 3.18.0 as the minversion for tox * Add a new job, openstack-cover-jobs, to run the coverage in Zuul Change-Id: If6fa3f2f861d5eb6787743edcc6333e5aacef7d0 --- .gitignore | 2 +- .stestr.conf | 3 +++ .testr.conf | 7 ------- .zuul.yaml | 1 + lower-constraints.txt | 2 +- test-requirements.txt | 2 +- tox.ini | 19 ++++++++++++++----- 7 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 83d369b..6255766 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,6 @@ eggs AUTHORS ChangeLog -.testrepository/ +.stestr/ cover/ .coverage diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..da121c8 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./blazarclient/tests/ +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 4da4d7d..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 $DISCOVER_DIRECTORY $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/.zuul.yaml b/.zuul.yaml index 54e7897..df9728c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,3 +4,4 @@ - openstack-lower-constraints-jobs - openstack-python3-xena-jobs - release-notes-jobs-python3 + - openstack-cover-jobs \ No newline at end of file diff --git a/lower-constraints.txt b/lower-constraints.txt index 0da54d6..52876aa 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -36,8 +36,8 @@ PyYAML==3.12 requests==2.14.2 requestsexceptions==1.2.0 rfc3986==0.3.1 +stestr==2.0.0 stevedore==1.20.0 -testrepository==0.0.18 testtools==2.2.0 traceback2==1.4.0 unittest2==1.1.0 diff --git a/test-requirements.txt b/test-requirements.txt index 636c742..78539c9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,6 +9,6 @@ pyflakes>=2.1.1 oslotest>=3.2.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT coverage!=4.4,>=4.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 9c603c8..2149296 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] -minversion = 3.1.1 -envlist = py36,py38,pep8 +minversion = 3.18.0 +envlist = py3,pep8 ignore_basepython_conflict = True [testenv] @@ -12,8 +12,7 @@ deps = -r{toxinidir}/requirements.txt setenv = VIRTUAL_ENV={envdir} DISCOVER_DIRECTORY=blazarclient/tests -commands = - python setup.py testr --slowest --testr-args="{posargs}" +commands = stestr run --slowest '{posargs}' [testenv:pep8] commands = flake8 @@ -37,8 +36,18 @@ deps = commands = {posargs} [testenv:cover] +allowlist_externals = find +setenv = + {[testenv]setenv} + PYTHON=coverage run --source blazarclient --parallel-mode commands = - python setup.py testr --coverage --testr-args='{posargs}' + coverage erase + find . -type f -name "*.pyc" -delete + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:lower-constraints] deps =