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
* Create cover environment in tox and make relevant changes
  in .gitignore

Signed-off-by: HeroicHitesh <email.hiteshkumar@gmail.com>
Change-Id: I3de659cdda2f490590dbfb38c81b95becac5da7c
This commit is contained in:
HeroicHitesh 2021-05-17 18:11:36 +05:30
parent b4d249a204
commit 7c62d3b53d
7 changed files with 41 additions and 15 deletions

21
.gitignore vendored
View File

@ -1,11 +1,24 @@
*.pyc
*.swp
*~
.tox
.testrepository
# Packages
*.egg*
*.egg-info
build
# Unit test / coverage reports
cover/
.coverage*
!.coveragerc
.tox
.stestr/
# 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=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -5,3 +5,4 @@
- publish-openstack-docs-pti
- release-notes-jobs-python3
- openstack-lower-constraints-jobs
- openstack-cover-jobs

View File

@ -66,7 +66,7 @@ salt==3001.1
simplejson==3.5.1
six==1.10.0
stevedore==1.20.0
testrepository==0.0.18
stestr==2.0.0
testscenarios==0.4
testtools==2.2.0
tornado==4.4.3

View File

@ -8,7 +8,7 @@ hacking>=3.0.1,<3.1.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
requests-mock>=1.1.0 # Apache-2.0
salt>=3001.1 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
os-apply-config>=5.0.0 # Apache-2.0

23
tox.ini
View File

@ -1,18 +1,17 @@
[tox]
envlist = py38,pep8
envlist = py3,pep8
ignore_basepython_conflict = true
minversion = 3.1.0
minversion = 3.18.0
skipsdist = True
[testenv]
basepython = python3
whitelist_externals = bash
allowlist_externals = bash
setenv = VIRTUAL_ENV={envdir}
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi'
testr run {posargs}
commands= stestr run --slowest {posargs}
[testenv:pep8]
commands = flake8
@ -31,6 +30,20 @@ show-source = True
builtins = _
exclude=.venv,.git,.tox,*lib/python*,private,.eggs
[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:releasenotes]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}