config/sysinv/cgts-client/cgts-client/tox.ini

113 lines
3.2 KiB
INI

[tox]
envlist = py39,pep8,pylint
minversion = 1.6
#skipsdist = True
# tox does not work if the path to the workdir is too long, so move it to /tmp
toxworkdir = /tmp/{env:USER}_cgtsclienttox
stxdir = {toxinidir}/../../../..
distshare={toxworkdir}/.tox/distshare
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_TEST_PATH=cgtsclient/tests
TESTR_START_DIR=cgtsclient/tests
basepython = python3
usedevelop = True
install_command = pip install \
-U \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/config/tsconfig/tsconfig
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
allowlist_externals =
bash
find
rm
passenv =
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
[testenv:py39]
basepython = python3.9
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
commands =
flake8 cgtsclient
[testenv:venv]
commands = {posargs}
[testenv:cover]
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
{[testenv]commands}
coverage erase
rm -f .coverage
rm -Rf cover
rm -f coverage.xml
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[flake8]
show-source = true
exclude=.*,dist,*lib/python*,*egg,build
max-complexity=25
# H102 Apache 2.0 license header not found
# H104 File contains nothing but comments
# H105 Don't use author tags
# H238 old style class declaration, use new style (inherit from `object`)
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# -B- codes are bugbear
# B004 Using `hasattr(x, '__call__')` to test if `x` is callable is unreliable.
# B005 Using .strip() with multi-character strings is misleading the reader.
# B006 Do not use mutable data structures for argument defaults
# B009 Do not call getattr with a constant attribute value
# B010 Do not call setattr with a constant attribute value
# B028 No explicit stacklevel keyword argument found
# -W- codes are warnings
# W503 line break before binary operator
# W504 line break after binary operator
# W605 invalid escape sequence
# -E- codes are errors
# E501 line too long
# E731 do not assign a lambda expression, use a def
# E741 ambiguous variable name
# -F- codes are errors
ignore = H102,H104,H105,H238,H404,H405,
B004,B005,B006,B009,B010,B028,
W503,W504,W605,
E501,E731,E741
[testenv:pylint]
commands = pylint {posargs} cgtsclient --rcfile=./pylint.rc --extension-pkg-whitelist=lxml.etree,greenlet
[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.
skip_install = True
deps = bindep
commands = bindep test