Make the measuring code coverage test working

Change-Id: I9e28b3b08685ea7a7ae1ed73888d8160728f5ded
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud (Strider) 2020-11-26 11:40:06 +01:00
parent bd122295ef
commit 5d55cfde1d
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
6 changed files with 33 additions and 13 deletions

View File

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

2
.gitignore vendored
View File

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

View File

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

View File

@ -22,6 +22,7 @@
check: check:
jobs: jobs:
- openstack-tox-linters - openstack-tox-linters
- openstack-tox-cover
- openstack-tox-docs: &tripleo-docs - openstack-tox-docs: &tripleo-docs
files: files:
- ^doc/.* - ^doc/.*

View File

@ -10,7 +10,7 @@ pyflakes>=2.1.1
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD
stestr>=1.0.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
pre-commit # MIT pre-commit # MIT

35
tox.ini
View File

@ -3,18 +3,27 @@ minversion = 3.2.0
envlist = linters,docs,py38 envlist = linters,docs,py38
skipdist = True 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] [testenv]
usedevelop = True usedevelop = True
passenv = * passenv =
TERM
setenv = setenv =
# pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207 # pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
# paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598 # paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_DISABLE_PIP_VERSION_CHECK=1
VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
HOME={envdir}
commands = commands =
stestr run {posargs} stestr run --slowest --color {posargs}
stestr slowest
sitepackages = True
deps = deps =
-c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r {toxinidir}/requirements.txt -r {toxinidir}/requirements.txt
@ -57,11 +66,21 @@ commands =
{[testenv:whitespace]commands} {[testenv:whitespace]commands}
{[testenv:shebangs]commands} {[testenv:shebangs]commands}
[testenv:venv]
commands = {posargs}
passenv = *
[testenv:cover] [testenv:cover]
deps = setenv =
-r {toxinidir}/requirements.txt PYTHON=coverage run --source validations_libs --parallel-mode
-r {toxinidir}/test-requirements.txt HOME={envdir}
commands = python setup.py test --coverage --testr-args='{posargs}' commands =
coverage erase
stestr run --color {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs] [testenv:docs]
deps = deps =