Migrate from testr to stestr

* Replace .testr.conf by .stestr.conf for migration and update
  .gitignore and test-requirements.txt files accordingly
* Use 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 and test-requirements.txt

Signed-off-by: HeroicHitesh <email.hiteshkumar@gmail.com>
Change-Id: I2bb0f23771e6ff1e3f775520a719514c2a3f3aa3
This commit is contained in:
HeroicHitesh 2021-05-18 12:17:06 +05:30
parent f26534191e
commit 4dfd64a7d2
6 changed files with 53 additions and 12 deletions

34
.gitignore vendored
View File

@ -1,7 +1,33 @@
heat_specs.egg-info/
doc/build/
.tox/
*.pyc
.testrepository
# Packages
*.egg*
*.egg-info
dist
build
# Unit test / coverage reports
cover/
.coverage*
!.coveragerc
.tox/
.stestr/
.venv
# Mr Developer
.project
.pydevproject
# Sphinx
doc/build/
# 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=./tests/
top_dir=./

View File

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

View File

@ -1,6 +1,7 @@
- project:
templates:
- openstack-specs-jobs
- openstack-cover-jobs
check:
jobs:
- openstack-tox-py38

View File

@ -1,3 +1,4 @@
testrepository>=0.0.18
coverage>=4.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
testtools>=0.9.34
testscenarios>=0.4

20
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
minversion = 1.6
minversion = 3.18.0
envlist = docs,pep8
skipsdist = True
@ -10,14 +10,28 @@ setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = find
allowlist_externals = find
commands =
find . -type f -name "*.pyc" -delete
python setup.py testr --slowest --testr-args='{posargs}'
stestr run --slowest {posargs}
[testenv:venv]
commands = {posargs}
[testenv:cover]
basepython = python3
allowlist_externals = find
setenv =
PYTHON=coverage run --source . --parallel-mode
commands =
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:docs]
commands = sphinx-build -W -a -b html doc/source doc/build/html