Migrate from testr to stestr

* Replace .testr.conf by .stestr.conf for migration and update
  .gitignore and test-requirements.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
* Create cover environment in tox and make relevant changes
  in .gitignore

Signed-off-by: HeroicHitesh <email.hiteshkumar@gmail.com>
Change-Id: Ib4f5ffe86221b0c97c6839f6b69ddae17b2b47c1
This commit is contained in:
HeroicHitesh 2021-05-17 21:36:21 +05:30 committed by ricolin
parent 27f9011d4c
commit 20ecaf34bb
6 changed files with 45 additions and 20 deletions

35
.gitignore vendored
View File

@ -1,15 +1,30 @@
*.pyc
*.swp
*~
build
dist
# Packages
*.egg*
*.egg-info
.venv
AUTHORS
ChangeLog
dist
build
# Unit test / coverage reports
cover/
.coverage*
!.coveragerc
.tox
.coverage
cover
.testrepository
.stestr/
.venv
# Mr Developer
.project
.pydevproject
# pbr generates these
AUTHORS
ChangeLog
# Editors
*.swp
*~
# Files created by releasenotes build
releasenotes/build

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./heat_cfnclient/tests/
top_dir=./

View File

@ -1,4 +0,0 @@
[DEFAULT]
test_command=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -1,3 +1,4 @@
- project:
templates:
- openstack-python3-xena-jobs
- openstack-cover-jobs

View File

@ -6,5 +6,5 @@
hacking>=3.0.1,<3.1.0 # Apache-2.0
coverage>=3.6
discover
testrepository>=0.0.18
stestr>=2.0.0 # Apache-2.0
testtools>=0.9.36,!=1.2.0

20
tox.ini
View File

@ -1,7 +1,7 @@
[tox]
envlist = py38,pep8
envlist = py3,pep8
ignore_basepython_conflict = true
minversion = 3.1.0
minversion = 3.18.0
skipsdist = True
[testenv]
@ -13,8 +13,7 @@ setenv = VIRTUAL_ENV={envdir}
usedevelop = True
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 heat_cfnclient bin/heat-cfn bin/heat-watch
@ -23,8 +22,19 @@ commands = flake8 heat_cfnclient bin/heat-cfn bin/heat-watch
commands = {posargs}
[testenv:cover]
basepython = python3
allowlist_externals = find
setenv =
{[testenv]setenv}
PYTHON=coverage run --source heat_cfnclient --parallel-mode
commands =
python setup.py testr --coverage
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
[flake8]
# F841 local variable 'json_template' is assigned to but never used