
Added in the following tox targets for fm-rest-api: - bandit - flake8 / pep8 - pylint (suppressing most of the codes) All the tox targets run on python3 The test-requirements.txt have been updated The StarlingX Debian upper constraints are utilized. The spec-lint (rpm) job is removed from Zuul. Zuul runs pylint for sub directories Bandit exclusions are updated. Included a change to a .py file to trigger the bandit zuul job. Test Plan (for fm-rest-api) PASS: tox -e bandit PASS: tox -e coverage PASS: tox -e flake8 PASS: tox -e pylint Story: 2010531 Task: 47575 Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I7ecaf1c90495b283c26e02e3b481bfe4c77c3939
90 lines
2.7 KiB
INI
90 lines
2.7 KiB
INI
[tox]
|
|
envlist = flake8,py39,bandit,pylint
|
|
minversion = 2.3
|
|
skipsdist = True
|
|
stxdir = {toxinidir}/../../../
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
install_command = pip install -U {opts} {packages}
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_STDERR_CAPTURE=1
|
|
OS_TEST_TIMEOUT=60
|
|
deps = -chttps://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
|
-e{[tox]stxdir}/config/sysinv/cgts-client/cgts-client
|
|
-e{[tox]stxdir}/fault/fm-api/source
|
|
-e{[tox]stxdir}/fault/fm-rest-api/fm
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[bandit]
|
|
# B101 assert_used
|
|
# B104 hardcoded_bind_all_interfaces
|
|
# B314 blacklist xml.etree
|
|
skips = B101,B104,B314
|
|
exclude = tests
|
|
|
|
[testenv:bandit]
|
|
commands = bandit --ini tox.ini -n 5 -r fm
|
|
|
|
[flake8]
|
|
# WE WANT TO ENABLE H106: Don't put vim configuration in source files (off by default).
|
|
# WE WANT TO ENABLE H904 Delay string interpolations at logging calls (off by default)
|
|
# H203: Use assertIs(Not)None to check for None (off by default).
|
|
enable-extensions = H203
|
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
|
|
|
# the following are ignored. These may be cleaned up in a future commit
|
|
# H104: File contains nothing but comments
|
|
# H105: Don't use author tags
|
|
# H301: one import per line
|
|
# H306: imports not in alphabetical order
|
|
# H401: docstring should not start with a space
|
|
# H404: multi line docstring should start without a leading new line
|
|
# H405: multi line docstring summary not separated with an empty line
|
|
# W504: line break after binary operator
|
|
# W605 invalid escape sequence
|
|
ignore = H104,H105,H301,H306,H401,H404,H405,W504,W605
|
|
# auth_token.py is 99 chars wide. The max length can be reduced as the files are updated
|
|
max-line-length = 99
|
|
show-source = True
|
|
|
|
[testenv:flake8]
|
|
commands = flake8 {posargs}
|
|
|
|
[testenv:pep8]
|
|
commands = flake8 {posargs}
|
|
|
|
[testenv:py39]
|
|
basepython = python3.9
|
|
commands =
|
|
stestr run {posargs}
|
|
stestr slowest
|
|
|
|
[testenv:cover]
|
|
setenv = {[testenv]setenv}
|
|
PYTHON=coverage run --parallel-mode
|
|
commands =
|
|
coverage erase
|
|
stestr run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report
|
|
|
|
[testenv:pylint]
|
|
commands = pylint fm --rcfile=./pylint.rc
|
|
|
|
[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
|