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]
branch = True
source = validations-libs
omit = validations-libs/openstack/*
source = validations_libs
omit = validations_libs/tests/*
[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_libs/tests
test_path=${TEST_PATH:-./validations_libs/tests}
top_dir=./

View File

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

View File

@ -10,7 +10,7 @@ pyflakes>=2.1.1
coverage!=4.4,>=4.0 # Apache-2.0
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
testtools>=2.2.0 # MIT
pre-commit # MIT

35
tox.ini
View File

@ -3,18 +3,27 @@ minversion = 3.2.0
envlist = linters,docs,py38
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 =
# 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
VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
HOME={envdir}
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
@ -57,11 +66,21 @@ commands =
{[testenv:whitespace]commands}
{[testenv:shebangs]commands}
[testenv:venv]
commands = {posargs}
passenv = *
[testenv:cover]
deps =
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
commands = python setup.py test --coverage --testr-args='{posargs}'
setenv =
PYTHON=coverage run --source validations_libs --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 =