30c723e711
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: I0f85b328488743361b6070febef80008efab1358
84 lines
2.0 KiB
INI
84 lines
2.0 KiB
INI
# Source charm: ./tox.ini
|
|
# This file is managed centrally by release-tools and should not be modified
|
|
# within individual charm repos.
|
|
[tox]
|
|
skipsdist = True
|
|
envlist = pep8,py34,py35
|
|
skip_missing_interpreters = True
|
|
|
|
[testenv]
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
PYTHONHASHSEED=0
|
|
TERM=linux
|
|
LAYER_PATH={toxinidir}/layers
|
|
INTERFACE_PATH={toxinidir}/interfaces
|
|
JUJU_REPOSITORY={toxinidir}/build
|
|
passenv = http_proxy https_proxy
|
|
install_command =
|
|
pip install {opts} {packages}
|
|
deps =
|
|
-r{toxinidir}/requirements.txt
|
|
|
|
[testenv:build]
|
|
basepython = python2.7
|
|
commands =
|
|
charm-build --log-level DEBUG -o {toxinidir}/build src {posargs}
|
|
|
|
[testenv:py27]
|
|
basepython = python2.7
|
|
# Reactive source charms are Python3-only, but a py27 unit test target
|
|
# is required by OpenStack Governance. Remove this shim as soon as
|
|
# permitted. http://governance.openstack.org/reference/cti/python_cti.html
|
|
whitelist_externals = true
|
|
commands = true
|
|
|
|
[testenv:py34]
|
|
basepython = python3.4
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = ostestr {posargs}
|
|
|
|
[testenv:py35]
|
|
basepython = python3.5
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = ostestr {posargs}
|
|
|
|
[testenv:pep8]
|
|
basepython = python3.5
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = flake8 {posargs} src unit_tests
|
|
|
|
[testenv:cover]
|
|
# Technique based heavily upon
|
|
# https://github.com/openstack/nova/blob/master/tox.ini
|
|
basepython = python3
|
|
deps = -r{toxinidir}/requirements.txt
|
|
-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/*
|
|
|
|
[testenv:venv]
|
|
basepython = python3
|
|
commands = {posargs}
|
|
|
|
[flake8]
|
|
# E402 ignore necessary for path append before sys module import in actions
|
|
ignore = E402
|