Make the measuring code coverage test working

Change-Id: Ice9a3ddbced8562ab4c71d0331ace53b83f4fc93
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud (Strider) 2021-02-08 12:50:43 +01:00
parent 87bc59af5b
commit 4c610b35b9
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
5 changed files with 30 additions and 13 deletions

View File

@ -1,7 +1,6 @@
[run]
branch = True
source = validations-common
omit = validations-common/openstack/*
[report]
ignore_errors = True

2
.gitignore vendored
View File

@ -29,7 +29,7 @@ cover/
nosetests.xml
.testrepository
.venv
.stestr/
.stestr/*
# Translations
*.mo

View File

@ -1,3 +1,3 @@
[DEFAULT]
test_path=./validations_common/tests
test_path=${TEST_PATH:-./validations_common/tests}
top_dir=./

View File

@ -38,6 +38,7 @@
check:
jobs:
- openstack-tox-linters
- openstack-tox-cover
- validations-common-functional
gate:
jobs:

37
tox.ini
View File

@ -3,9 +3,15 @@ minversion = 3.2.0
envlist = linters,docs,py38,molecule
skipdist = True
# Automatic envs (pyXX) will only use the python version appropriate to that
# env and ignore basepython inherited from [testenv] if we set
# ignore_basepython_conflict.
ignore_basepython_conflict = True
[testenv]
usedevelop = True
passenv = *
passenv =
TERM
setenv =
ANSIBLE_CALLBACK_PLUGINS={toxinidir}/validations_common/callback_plugins
ANSIBLE_LOOKUP_PLUGINS={toxinidir}/validations_common/lookup_plugins
@ -18,11 +24,13 @@ setenv =
# pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
# paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
PIP_DISABLE_PIP_VERSION_CHECK=1
PIP_+ VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
HOME={envdir}DISABLE_PIP_VERSION_CHECK=1
commands =
stestr run {posargs}
stestr slowest
sitepackages = True
stestr run --slowest --color {posargs}
deps =
-c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r {toxinidir}/requirements.txt
@ -97,12 +105,21 @@ deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html
[testenv:venv]
commands = {posargs}
passenv = *
[testenv:cover]
deps =
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
-r {toxinidir}/molecule-requirements.txt
commands = python setup.py test --coverage --testr-args='{posargs}'
setenv =
PYTHON=coverage run --source validations_common --parallel-mode
HOME={envdir}
commands =
coverage erase
stestr run --color {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs]
deps =