From e5972742ce7776097a395420031baf3d8399eb43 Mon Sep 17 00:00:00 2001 From: Leonardo Fagundes Luz Serrano Date: Wed, 26 Jun 2024 17:21:55 -0300 Subject: [PATCH] Zuul: Fix test-requirements and satisfy pep8 requirements Fixes: - Missing comma in test-requirements.txt - pep8 requires base classes to inherit from 'object' Test Plan: pass - run tox Closes-Bug: 2070937 Change-Id: Ibe659bd0a02a7ca047d4406b9555a2419fdb915f Signed-off-by: Leonardo Fagundes Luz Serrano --- stx/lib/stx/config.py | 2 +- stx/lib/stx/k8s.py | 2 +- stx/lib/stx/stx_build.py | 2 +- stx/lib/stx/stx_cleanup.py | 2 +- stx/lib/stx/stx_configparser.py | 4 ++-- stx/lib/stx/stx_control.py | 2 +- stx/lib/stx/stx_main.py | 2 +- stx/lib/stx/stx_repomgr.py | 2 +- stx/lib/stx/stx_shell.py | 2 +- stx/toCOPY/pkgbuilder/debbuilder.py | 2 +- stx/toCOPY/pkgbuilder/schrootspool.py | 4 ++-- test-requirements.txt | 10 +++++----- tox.ini | 10 +--------- 13 files changed, 19 insertions(+), 27 deletions(-) diff --git a/stx/lib/stx/config.py b/stx/lib/stx/config.py index aa76fd16..b48ee15d 100644 --- a/stx/lib/stx/config.py +++ b/stx/lib/stx/config.py @@ -38,7 +38,7 @@ def require_env(var): return value -class Config: +class Config(object): """Configuration interface. This class provides a read-only interface to project diff --git a/stx/lib/stx/k8s.py b/stx/lib/stx/k8s.py index a3e3b215..61de5f65 100644 --- a/stx/lib/stx/k8s.py +++ b/stx/lib/stx/k8s.py @@ -22,7 +22,7 @@ logger = logging.getLogger('STX-k8s') utils.set_logger(logger) -class KubeHelper: +class KubeHelper(object): """Common k8s commands""" """Constructor: diff --git a/stx/lib/stx/stx_build.py b/stx/lib/stx/stx_build.py index 5a33558c..9837b8d6 100644 --- a/stx/lib/stx/stx_build.py +++ b/stx/lib/stx/stx_build.py @@ -25,7 +25,7 @@ STX_BUILD_TYPES = ['rt', 'std'] STX_LAYERS = ['distro', 'flock'] -class HandleBuildTask: +class HandleBuildTask(object): '''Handle the task for the build sub-command''' def __init__(self, config): diff --git a/stx/lib/stx/stx_cleanup.py b/stx/lib/stx/stx_cleanup.py index be9af6c9..3b4b0753 100644 --- a/stx/lib/stx/stx_cleanup.py +++ b/stx/lib/stx/stx_cleanup.py @@ -22,7 +22,7 @@ logger = logging.getLogger('STX-Cleanup') utils.set_logger(logger) -class HandleCleanupTask: +class HandleCleanupTask(object): def __init__(self, config, shell): self.config = config diff --git a/stx/lib/stx/stx_configparser.py b/stx/lib/stx/stx_configparser.py index a1678c41..1c1f6af1 100644 --- a/stx/lib/stx/stx_configparser.py +++ b/stx/lib/stx/stx_configparser.py @@ -27,7 +27,7 @@ logger = logging.getLogger('STX-Config-Parser') utils.set_logger(logger) -class STXConfigParser: +class STXConfigParser(object): def __init__(self, filepath=None): if filepath: @@ -263,7 +263,7 @@ class STXConfigParser: logger.warning("These changes will take effect after you restart your builder containers") -class HandleConfigTask: +class HandleConfigTask(object): '''Handle the task for the config sub-command''' def __init__(self, config): diff --git a/stx/lib/stx/stx_control.py b/stx/lib/stx/stx_control.py index 94f43aac..72c34a04 100644 --- a/stx/lib/stx/stx_control.py +++ b/stx/lib/stx/stx_control.py @@ -30,7 +30,7 @@ from stx import utils # pylint: disable=E0611 helmchartdir = 'stx/stx-build-tools-chart/stx-builder' -class HandleControlTask: +class HandleControlTask(object): '''Handle the task for the control sub-command''' def __init__(self, config): diff --git a/stx/lib/stx/stx_main.py b/stx/lib/stx/stx_main.py index 9248f6c5..2cba4fce 100644 --- a/stx/lib/stx/stx_main.py +++ b/stx/lib/stx/stx_main.py @@ -32,7 +32,7 @@ class STXMainException(Exception): pass -class CommandLine: +class CommandLine(object): '''Handles parsing the commandline parameters for stx tool''' def __init__(self): diff --git a/stx/lib/stx/stx_repomgr.py b/stx/lib/stx/stx_repomgr.py index ed09d281..64411b99 100644 --- a/stx/lib/stx/stx_repomgr.py +++ b/stx/lib/stx/stx_repomgr.py @@ -22,7 +22,7 @@ logger = logging.getLogger('STX-Repomgr') utils.set_logger(logger) -class HandleRepomgrTask: +class HandleRepomgrTask(object): def __init__(self, config): self.config = config diff --git a/stx/lib/stx/stx_shell.py b/stx/lib/stx/stx_shell.py index ca10a5d7..b94da56e 100644 --- a/stx/lib/stx/stx_shell.py +++ b/stx/lib/stx/stx_shell.py @@ -32,7 +32,7 @@ def quote(wordlist): return shlex.quote(wordlist) -class HandleShellTask: +class HandleShellTask(object): def __init__(self, config): self.config = config diff --git a/stx/toCOPY/pkgbuilder/debbuilder.py b/stx/toCOPY/pkgbuilder/debbuilder.py index 65f5be80..ea2bc1c3 100644 --- a/stx/toCOPY/pkgbuilder/debbuilder.py +++ b/stx/toCOPY/pkgbuilder/debbuilder.py @@ -36,7 +36,7 @@ def check_request(request_form, needed_form): return response -class Debbuilder: +class Debbuilder(object): """ Debbuilder querys/creates/saves/restores the schroot for sbuild The default name of schroot is '-amd64-' diff --git a/stx/toCOPY/pkgbuilder/schrootspool.py b/stx/toCOPY/pkgbuilder/schrootspool.py index dbdfa080..619094e1 100644 --- a/stx/toCOPY/pkgbuilder/schrootspool.py +++ b/stx/toCOPY/pkgbuilder/schrootspool.py @@ -18,7 +18,7 @@ import subprocess SCHROOTS_CONFIG = '/etc/schroot/chroot.d/' -class Schroot: +class Schroot(object): def __init__(self, name, state='idle'): self.name = name self.state = state @@ -35,7 +35,7 @@ class Schroot: return self.name -class SchrootsPool: +class SchrootsPool(object): """ schrootsPool manages all the schroots in current container The schroots listed by schroot -l will be registered diff --git a/test-requirements.txt b/test-requirements.txt index 404071d6..c5e5533b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,5 @@ -bashate >= 0.2 -PyYAML>=3.1.0 -yamllint>=0.5.2 -hacking>=2.0<2.1 -astroid <= 2.2.5 +astroid <=2.2.5 +bashate >=0.2 +hacking >=2.0, <2.1 +PyYAML >=3.1.0 +yamllint >=0.5.2 diff --git a/tox.ini b/tox.ini index 03edb98e..2bf44a22 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ minversion = 2.3 skipsdist = True [testenv] +basepython = python3 install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/upper-constraints.txt} {opts} {packages} setenv = VIRTUAL_ENV={envdir} OS_STDOUT_CAPTURE=1 @@ -13,7 +14,6 @@ deps = -r{toxinidir}/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) @@ -33,18 +33,14 @@ commands = -print0 | xargs -0 bashate -v -iE006,E040" [testenv:pep8] -basepython = python3 usedevelop = False description = Run style checks. - commands = flake8 stx [testenv:pylint] -basepython = python3 sitepackages = False - deps = {[testenv]deps} ruamel.yaml pylint<2.5.0 @@ -64,11 +60,9 @@ ignore = E123,E125,E265,E266,E501,H404,H405,W504,F401 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-* [testenv:venv] -basepython = python3 commands = {posargs} [testenv:docs] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build @@ -76,7 +70,6 @@ commands = allowlist_externals = rm [testenv:releasenotes] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build @@ -84,7 +77,6 @@ commands = allowlist_externals = rm [testenv:newnote] -basepython = python3 # Re-use the releasenotes venv envdir = {toxworkdir}/releasenotes deps = -r{toxinidir}/doc/requirements.txt