Get code coverage when running test cases.

Change-Id: Ieae7e463ca766541fa0d085d04a6963e251a554f
This commit is contained in:
Federico Ressi 2018-11-26 15:42:41 +01:00
parent e3ede09cad
commit b5a02e0a29
3 changed files with 16 additions and 3 deletions

2
.gitignore vendored
View File

@ -5,6 +5,7 @@
# Hidden files
.eggs
.coverage*
.stestr
.test
.testrepository
@ -15,6 +16,7 @@ __pycache__
AUTHORS
build/*
ChangeLog
cover/
doc/build/*
dist/
etc/

View File

@ -1,4 +1,5 @@
mock >= 2.0 # BSD
testscenarios>=0.4
testtools>=2.2.0
tempest>=17.1.0
tempest>=17.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0

14
tox.ini
View File

@ -11,13 +11,23 @@ install_command =
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning,{env:PYTHONWARNINGS:}
PYTHONWARNINGS=ignore::Warning,{env:PYTHONWARNINGS:}
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
PYTHON=coverage run --source tobiko --parallel-mode
whitelist_externals=
find
commands =
stestr run {posargs}
coverage erase
find . -type f -name "*.pyc" -delete
stestr --test-path ./tobiko/tests run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
deps =
-r{toxinidir}/test-requirements.txt