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>
This commit is contained in:
Michel Thebeau 2023-07-24 10:46:00 -04:00
parent f5407b51a7
commit 7ff7e09392
4 changed files with 24 additions and 2 deletions

View File

@ -7,11 +7,13 @@
- openstack-tox-linters
- openstack-tox-pylint
- tox-unittests
- tox-flake8
gate:
jobs:
- openstack-tox-linters
- openstack-tox-pylint
- tox-unittests
- tox-flake8
- job:
name: tox-unittests
@ -19,3 +21,10 @@
description: Run unit tests
vars:
tox_envlist: unittests
- job:
name: tox-flake8
parent: tox
description: Run pep8/flake8
vars:
tox_envlist: flake8

View File

@ -3,9 +3,11 @@
import sys
import yaml
def print_help():
print("./config.py <config_file> <key>",
file=sys.stderr)
file=sys.stderr)
def readvalue(config_file, key):
@ -21,6 +23,7 @@ def readvalue(config_file, key):
except KeyError as e:
print('KeyError: %s' % e, file=sys.stderr)
if __name__ == "__main__":
args = sys.argv[1:]

View File

@ -1,3 +1,4 @@
hacking>=1.1.0,<=2.0.0 # Apache-2.0
yamllint === 1.32.0
bashate === 2.1.1
pylint === 2.13.9

11
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = linters,pylint,unittests
envlist = linters,flake8,pylint,unittests
minversion = 2.3
skipsdist = True
@ -27,6 +27,15 @@ commands =
-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