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
This commit is contained in:
Anand Bhat 2021-06-24 17:52:47 +05:30
parent 1cf4d73dd5
commit 27c426a76f
7 changed files with 21 additions and 15 deletions

2
.gitignore vendored
View File

@ -11,6 +11,6 @@ eggs
AUTHORS AUTHORS
ChangeLog ChangeLog
.testrepository/ .stestr/
cover/ cover/
.coverage .coverage

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./blazarclient/tests/
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 $DISCOVER_DIRECTORY $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -4,3 +4,4 @@
- openstack-lower-constraints-jobs - openstack-lower-constraints-jobs
- openstack-python3-xena-jobs - openstack-python3-xena-jobs
- release-notes-jobs-python3 - release-notes-jobs-python3
- openstack-cover-jobs

View File

@ -36,8 +36,8 @@ PyYAML==3.12
requests==2.14.2 requests==2.14.2
requestsexceptions==1.2.0 requestsexceptions==1.2.0
rfc3986==0.3.1 rfc3986==0.3.1
stestr==2.0.0
stevedore==1.20.0 stevedore==1.20.0
testrepository==0.0.18
testtools==2.2.0 testtools==2.2.0
traceback2==1.4.0 traceback2==1.4.0
unittest2==1.1.0 unittest2==1.1.0

View File

@ -9,6 +9,6 @@ pyflakes>=2.1.1
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD 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 testtools>=2.2.0 # MIT
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0

19
tox.ini
View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 3.1.1 minversion = 3.18.0
envlist = py36,py38,pep8 envlist = py3,pep8
ignore_basepython_conflict = True ignore_basepython_conflict = True
[testenv] [testenv]
@ -12,8 +12,7 @@ deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=blazarclient/tests DISCOVER_DIRECTORY=blazarclient/tests
commands = commands = stestr run --slowest '{posargs}'
python setup.py testr --slowest --testr-args="{posargs}"
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8
@ -37,8 +36,18 @@ deps =
commands = {posargs} commands = {posargs}
[testenv:cover] [testenv:cover]
allowlist_externals = find
setenv =
{[testenv]setenv}
PYTHON=coverage run --source blazarclient --parallel-mode
commands = 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] [testenv:lower-constraints]
deps = deps =