monasca-notification/tox.ini
Martin Chacon Piza f519f2d67e Fix and unify cover environment
Fix cover environment and unify it accordingly to Project Testing
Interface [1].

[1] https://governance.openstack.org/tc/reference/pti/python.html#coverage-jobs

Change-Id: I24335128cb3566e4104ddc6dad9a53f1a5ec249b
2020-05-27 18:30:03 +02:00

100 lines
2.6 KiB
INI

[tox]
envlist = py37,pep8,cover
minversion = 2.7
skipsdist = True
[testenv]
basepython = python3
setenv =
VIRTUAL_ENV={envdir}
OS_TEST_PATH=tests
passenv =
*_proxy
*_PROXY
usedevelop = True
install_command = pip install {opts} {packages}
whitelist_externals = bash
find
rm
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
.[jira_plugin]
commands =
find . -type f -name "*.pyc" -delete
stestr run {posargs}
[testenv:cover]
description = Calculates code coverage
setenv =
PYTHON=coverage run --source monasca_notification --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:debug]
commands =
oslo_debug_helper -t ./monasca_notification/tests {posargs}
[testenv:pep8]
commands =
{[testenv:flake8]commands}
{[testenv:bandit]commands}
[testenv:venv]
commands = {posargs}
[testenv:flake8]
commands =
flake8 monasca_notification
flake8 tests
[testenv:bandit]
commands =
bandit -r monasca_notification -n5 -x monasca_notification/tests
[testenv:genconfig]
description = Generates an example of monasca-notification configuration file
commands = oslo-config-generator \
--config-file={toxinidir}/config-generator/notification.conf
[flake8]
max-line-length = 100
# TODO: ignored checks should be enabled in the future
# H201 no 'except:' at least use 'except Exception:'
# H202: assertRaises Exception too broad
# H405 multi line docstring summary not separated with an empty line
ignore = F821,H201,H202,H405
exclude=.venv,.git,.tox,dist,*egg,build
[hacking]
import_exceptions =
six.moves
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
.[jira_plugin]
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html \
releasenotes/source releasenotes/build/html
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files, and develop mode disabled
# explicitly to avoid unnecessarily installing the checked-out repo too (this
# further relies on "tox.skipsdist = True" above).
deps = bindep
commands = bindep test
usedevelop = False