update/sw-patch/cgcs-patch/tox.ini

136 lines
3.8 KiB
INI

#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
[tox]
envlist = pep8,py39,pylint,bandit,cover
minversion = 2.3.2
skipsdist = True
stxdir = {toxinidir}/../../..
[testenv]
basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/config/tsconfig/tsconfig
install_command = pip install \
-v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
passenv =
XDG_CACHE_HOME
setenv = VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
OS_STDERR_CAPTURE=1
OS_STDOUT_CAPTURE=1
OS_TEST_PATH=./cgcs_patch/tests
OS_TEST_TIMEOUT=60
PYTHONDONTWRITEBYTECODE=1
PYTHONHASHSEED=0
PYTHONWARNINGS=ignore::DeprecationWarning,ignore::SyntaxWarning
PIP_DISABLE_PIP_VERSION_CHECK=1
sitepackages = False
usedevelop = true
whitelist_externals = find
sh
[testenv:stestr]
commands =
find . -name "*.pyc" -delete
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
commands = {[testenv:stestr]commands}
[testenv:py39]
basepython = python3.9
commands = {[testenv:stestr]commands}
[bandit]
# B101: Test for use of assert
# B104: Test for binding to all interfaces
# B110: Try, Except, Pass detected.
# B303: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
# B311: Standard pseudo-random generators are not suitable for security/cryptographic purposes
# B318: Blacklisted calls to xml.dom.minidom
# B320: Blacklisted calls to lxml.etree.parse
# B404: Import of subprocess module
# B408: import xml.minidom
# B410: import etree
# B602: Test for use of popen with shell equals true
# B603: Test for use of subprocess without shell equals true
# B607: Test for starting a process with a partial path
skips = B101,B104,B110,B303,B311,B318,B320,B404,B408,B410,B602,B603,B607
exclude = tests
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = bandit --ini tox.ini -n 5 -r cgcs_patch
[flake8]
# ignore below errors , will fix flake8 errors in future
# H306 imports not in alphabetical order
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# Note: W503 and W504 are mutually exclusive. Must select one of them to suppress.
# W504 line break after binary operator
# E501 line too long. skipped because some of the code files include templates
# that end up quite wide
show-source = True
ignore = H306,H404,H405,W504,E501
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
# H106: Don't put vim configuration in source files (off by default).
# H203: Use assertIs(Not)None to check for None (off by default).
# H904 Delay string interpolations at logging calls (off by default)
enable-extensions = H106 H203,H904
max-line-length = 80
[testenv:flake8]
commands = flake8 {posargs}
[testenv:pep8]
commands = flake8 {posargs}
[testenv:pylint]
commands = pylint cgcs_patch cgcs_make_patch --rcfile=./pylint.rc
[testenv:prospector]
basepython = python3.9
deps = {[testenv]deps}
prospector
commands = prospector cgcs_patch
[testenv:vulture]
basepython = python3.9
deps = {[testenv]deps}
vulture
commands = vulture cgcs_make_patch cgcs_patch
[testenv:cover]
setenv =
PYTHONWARNINGS=ignore::DeprecationWarning,ignore::SyntaxWarning
PYTHON=coverage run --parallel-mode
PYTHONDONTWRITEBYTECODE=True
commands = coverage erase
find . -name "*.pyc" -delete
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report