Michel Thebeau 7ff7e09392 libvirt: add pep8/flake8 to tox job
Using config/sysinv/sysinv/sysinv as example of setup for pep8/flake8.

Fix reported errors for config.py.

Story: 2010816
Task: 48450

Change-Id: Ia0e511fd827b5d697a6b41b7064d13ab64efb779
Signed-off-by: Michel Thebeau <Michel.Thebeau@windriver.com>
2023-07-24 17:15:45 -04:00

63 lines
1.8 KiB
INI

[tox]
envlist = linters,flake8,pylint,unittests
minversion = 2.3
skipsdist = True
[testenv]
deps = -r{toxinidir}/requirements/test-requirements.txt
allowlist_externals = reno
[testenv:linters]
basepython = python3
# bashate ignore:
# E006 - accept long lines
# E040 - false positive on |& syntax (new in bash 4)
allowlist_externals = bash
commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-not \( -type f -path *template* -prune \) \
-print0 | xargs -0 yamllint"
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs -0 bashate -v -iE006,E040"
[flake8]
ignore =
exclude = regression
max-line-length=80
[testenv:flake8]
commands =
flake8 {posargs} libvirt/
[testenv:pylint]
basepython = python3
sitepackages = False
setenv =
BASEPATH = {toxinidir}/virtualbox/pybox
PYTHONPATH= {env:BASEPATH}:{env:BASEPATH}/helper:{env:BASEPATH}/consts:{env:BASEPATH}/utils
deps =
-r{env:BASEPATH}/requirements.txt
{[testenv]deps}
allowlist_externals = pylint
commands = pylint {posargs} --rcfile=./pylint.rc virtualbox/pybox libvirt
[testenv:unittests]
basepython = python3
setenv =
BASEPATH = {toxinidir}/virtualbox/pybox
PYTHONPATH= {env:BASEPATH}:{env:BASEPATH}/helper:{env:BASEPATH}/consts:{env:BASEPATH}/utils
deps =
-r{toxinidir}/virtualbox/pybox/requirements.txt
coverage
change_dir = {env:BASEPATH}
commands =
coverage run -m unittest discover
coverage report -m