Reed, Joshua 4fae364bfe Update app Zuul Check Jobs.
Modify code to conform to flake8 and pylint.

Jobs are now flake8, pylint, py39 and metadata.

Test Plan
PASS - All zuul jobs pass as expected.

Story: 2010929
Task: 49253

Change-Id: I1239b1c2a952d822bf5ba7348acc2ff1ce80dd97
Signed-off-by: Reed, Joshua <Joshua.Reed@windriver.com>
2023-12-13 13:23:46 -07:00

112 lines
3.4 KiB
INI

[tox]
envlist = flake8,py39,pylint,bandit,metadata
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}_k8sapp_kubernetes_power_manager_tox
stxdir = {toxinidir}/../../..
distshare={toxworkdir}/.tox/distshare
[testenv]
sitepackages = True
basepython = python3.9
allowlist_externals = bash
find
echo
install_command = pip install -v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
commands =
find . -type f -name "*.pyc" -delete
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
PYTHONDONTWRITEBYTECODE=1
OS_TEST_PATH=./k8sapp_kubernetes_power_manager/tests
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
SYSINV_TEST_ENV=True
EVENTS_YAML=./k8sapp_kubernetes_power_manager/tests/events_for_testing.yaml
TOX_WORK_DIR={toxworkdir}
PYLINTHOME={toxworkdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
-e{[tox]stxdir}/config/tsconfig/tsconfig
-e{[tox]stxdir}/fault/fm-api/source
-e{[tox]stxdir}/fault/python-fmclient/fmclient
-e{[tox]stxdir}/utilities/ceph/python-cephclient/python-cephclient
-e{[tox]stxdir}/update/sw-patch/cgcs-patch
[flake8]
# H series are hacking
# H403 multi line docstrings should end on a new line
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
ignore = H403,H404,H405,W503,W504
# Ignoring
per-file-ignores =
k8sapp_kubernetes_power_manager/common/constants.py: E501
exclude = build,dist,tools,.eggs
max-line-length=80
[testenv:flake8]
deps = -r{toxinidir}/test-requirements.txt
commands =
flake8 {posargs} .
[testenv:py39]
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:venv]
commands = {posargs}
[bandit]
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
bandit
commands = bandit --ini tox.ini -n 5 -r k8sapp_kubernetes_power_manager
[testenv:pylint]
commands =
pylint {posargs} k8sapp_kubernetes_power_manager --rcfile=./pylint.rc
[testenv:cover]
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
{[testenv]commands}
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:pip-missing-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages
# this also means that pip-missing-reqs must be installed separately, outside
# of the requirements.txt files
deps = pip_missing_reqs
-rrequirements.txt
commands=pip-missing-reqs -d --ignore-file=/k8sapp_kubernetes_power_manager/tests k8sapp_kubernetes_power_manager
[testenv:metadata]
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}
# Pass top level app folder to 'sysinv-app tox' command.
commands =
bash -c "echo $(dirname $(dirname $(pwd))) | xargs -n 1 sysinv-app tox"