Added tox environment for gathering coverage
This technique was borrowed from the tox "cover" environment in openstack/nova's tox.ini. This leverages the fact that stestr lets you override the python executable via the PYTHON environment variable. Doing this allows us to easily generate coverage for our unit tests. An important caveat is that this does not provide any coverage for tests via zaza, amulet, etc. It is purely focused on the unit tests. Note that this replaces the previous .coveragerc; coverage configuration is instead pulled from tox.ini. Change-Id: I78170741219749d8bfb5eb7eb247877814fb9824
This commit is contained in:
parent
15a4e6c8ee
commit
3dd814ef13
@ -1,3 +1,4 @@
|
|||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- python35-charm-jobs
|
- python35-charm-jobs
|
||||||
|
- openstack-cover-jobs
|
||||||
|
27
tox.ini
27
tox.ini
@ -30,6 +30,33 @@ basepython = python3
|
|||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
commands = flake8 {posargs}
|
commands = flake8 {posargs}
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
# Technique based heavily upon
|
||||||
|
# https://github.com/openstack/nova/blob/master/tox.ini
|
||||||
|
basepython = python3
|
||||||
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
setenv =
|
||||||
|
{[testenv]setenv}
|
||||||
|
PYTHON=coverage run
|
||||||
|
commands =
|
||||||
|
coverage erase
|
||||||
|
ostestr {posargs}
|
||||||
|
coverage combine
|
||||||
|
coverage html -d cover
|
||||||
|
coverage xml -o cover/coverage.xml
|
||||||
|
coverage report
|
||||||
|
|
||||||
|
[coverage:run]
|
||||||
|
branch = True
|
||||||
|
concurrency = multiprocessing
|
||||||
|
parallel = True
|
||||||
|
source =
|
||||||
|
.
|
||||||
|
omit =
|
||||||
|
.tox/*
|
||||||
|
*/charmhelpers/*
|
||||||
|
unit_tests/*
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user