Cleanup tox and zuul

tox changes:
 - remove python2.7 and python3.6 unit test targets
   from tox.ini since only python 3.9 is supported
 - tox jobs are now setup for python 3.9
 - Added additional suppressions for new pylint codes.

Zuul changes:
 - remove py27 job from zuul
 - set the parent zuul jobs to be the jobs defined under
   openstack-zuul-jobs rather than just zuul-jobs
 - Specify debian-bullseye (python3.9) as the nodeset.
   ubuntu-jammy is python3.10, ubuntu-focal is python3.8
 - override tox constraints file to use the STX constraints
   This means starlingx/root needs to be a required project

Notes:
- these changes do not affect runtime.

Test Plan:
pass tox
pass build-pkgs

Story: 2010531
Task: 47511

Signed-off-by: Leonardo Fagundes Luz Serrano <Leonardo.FagundesLuzSerrano@windriver.com>
Change-Id: I4649c60e669b546ff8b31df832e6e16b348f2fee
This commit is contained in:
Leonardo Fagundes Luz Serrano 2023-02-24 11:00:10 -03:00
parent 770e5f01d7
commit aa03f479f2
5 changed files with 36 additions and 64 deletions

View File

@ -5,7 +5,6 @@
check:
jobs:
- openstack-tox-linters
- k8sapp-platform-tox-py27
- k8sapp-platform-tox-py39
- k8sapp-platform-tox-flake8
- k8sapp-platform-tox-pylint
@ -13,7 +12,6 @@
gate:
jobs:
- openstack-tox-linters
- k8sapp-platform-tox-py27
- k8sapp-platform-tox-py39
- k8sapp-platform-tox-flake8
- k8sapp-platform-tox-pylint
@ -22,26 +20,9 @@
jobs:
- stx-platform-armada-app-upload-git-mirror
- job:
name: k8sapp-platform-tox-py27
parent: tox
description: |
Run py27 test for k8sapp_platform
nodeset: ubuntu-xenial
required-projects:
- starlingx/config
- starlingx/fault
- starlingx/update
- starlingx/utilities
files:
- python-k8sapp-platform/*
vars:
tox_envlist: py27
tox_extra_args: -c python-k8sapp-platform/k8sapp_platform/tox.ini
- job:
name: k8sapp-platform-tox-py39
parent: tox-py39
parent: openstack-tox-py39
description: |
Run py39 test for k8sapp_platform
nodeset: debian-bullseye
@ -50,19 +31,19 @@
- starlingx/fault
- starlingx/update
- starlingx/utilities
- starlingx/root
files:
- python-k8sapp-platform/*
vars:
tox_envlist: py39
python_version: 3.9
tox_extra_args: -c python-k8sapp-platform/k8sapp_platform/tox.ini
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt'
- job:
name: k8sapp-platform-tox-flake8
parent: tox
description: |
Run flake8 test for k8sapp_platform
nodeset: ubuntu-focal
nodeset: debian-bullseye
files:
- python-k8sapp-platform/*
vars:
@ -74,24 +55,26 @@
parent: tox
description: |
Run pylint test for k8sapp_platform
nodeset: ubuntu-xenial
nodeset: debian-bullseye
required-projects:
- starlingx/config
- starlingx/fault
- starlingx/update
- starlingx/utilities
- starlingx/root
files:
- python-k8sapp-platform/*
vars:
tox_envlist: pylint
tox_extra_args: -c python-k8sapp-platform/k8sapp_platform/tox.ini
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt'
- job:
name: k8sapp-platform-tox-bandit
parent: tox
description: |
Run bandit test for k8sapp_platform
nodeset: ubuntu-focal
nodeset: debian-bullseye
files:
- python-k8sapp-platform/*
vars:

View File

@ -147,6 +147,7 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W0402: deprecated-module
# W0403: relative-import
# W0404: reimported
# W0602: global-variable-not-assigned
# W0603: global-statement
# W0612: unused-variable
# W0613: unused-argument
@ -154,28 +155,38 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W0622: redefined-builtin
# W0631: undefined-loop-variable
# W0632: unbalanced-tuple-unpacking
# W0701: bad-except-order
# W0703: broad-except
# W0701: bad-except-order
# W0706: The except handler raises immediately (try-except-raise)
# W0707: raise-missing-from
# W0719: broad-exception-raised
# W1113: keyword-arg-before-vararg
# W1201: logging-not-lazy
# W1401: anomalous-backslash-in-string
# W1505: deprecated-method
# W1406: redundant-u-string-prefix
# W1505: Using deprecated method getargspec() (deprecated-method)
# W1514: unspecified-encoding
# W1618: no-absolute-import (Python3 checker)
# W0237: arguments-renamed
# W4904: deprecated-class
# W4905: deprecated-decorator
# All these errors should be fixed:
# E0012: pylint for python3 does not support inline deprecation
# E0213: no-self-argument
# E0401: import-error
# E0604: invalid-all-object
# E0633: unpacking-non-sequence
# E0701: bad-except-order
# E1101: no-member
# E1102: not-callable
# E1111: assignment-from-no-return
# E1120: no-value-for-parameter
# E1121: too-many-function-args
# Disable Python3 checkers:
# W1618: no-absolute-import
disable=C, R, fixme, W0101, W0105, W0106, W0107, W0108, W0110, W0123, W0150,
W0201, W0211, W0212, W0221, W0223, W0231, W0235, W0311, W0402, W0403,
W0404, W0603, W0612, W0613, W0621, W0622, W0631, W0632, W0701, W0703,
W1113, W1201, W1401, W1505, W1618,
E0213, E0401, E0604, E0633, E0701, E1102, E1120, E1121
W0404, W0602, W0603, W0612, W0613, W0621, W0622, W0631, W0632, W0701,
W0706, W0707, W0719, W1113, W1201, W1401, W1406, W1505, W1514, W1618,
W0237, W4904, W4905, E0012, E0213, E0401, E0604, E0633, E0701, E1101,
E1102, E1111, E1120, E1121
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -14,8 +14,6 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5

View File

@ -1,5 +1,5 @@
[tox]
envlist = flake8,py27,py36,py39,pylint,bandit
envlist = flake8,py39,pylint,bandit
minversion = 1.6
# skipsdist = True
#,pip-missing-reqs
@ -10,6 +10,8 @@ stxdir = {toxinidir}/../../..
distshare={toxworkdir}/.tox/distshare
[testenv]
basepython = python3
# enabling usedevelop results in py27 develop-inst:
# Exception: Versioning for this project requires either an sdist tarball,
# or access to an upstream git repository.
@ -24,7 +26,7 @@ allowlist_externals = bash
install_command = pip install --use-deprecated legacy-resolver \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
# Note the hash seed is set to 0 until can be tested with a
@ -105,27 +107,8 @@ deps = -r{toxinidir}/test-requirements.txt
commands =
flake8 {posargs} .
[testenv:py27]
basepython = python2.7
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py39]
basepython = python3.9
install_command = pip install --use-deprecated legacy-resolver \
-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 =
{[testenv]commands}
stestr run {posargs}
@ -173,21 +156,18 @@ skips = B101,B103,B104,B105,B108,B110,B303,B307,B310,B311,B314,B318,B320,B404,B4
exclude = tests
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
bandit
commands = bandit --ini tox.ini -n 5 -r k8sapp_platform
[testenv:pylint]
basepython = python2.7
deps = {[testenv]deps}
pylint
commands =
pylint {posargs} k8sapp_platform --rcfile=./pylint.rc
[testenv:cover]
basepython = python2.7
deps = {[testenv]deps}
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode

10
tox.ini
View File

@ -1,11 +1,14 @@
[tox]
envlist = linters
minversion = 2.3
minversion = 2.9
skipsdist = True
sitepackages=False
[testenv]
install_command = pip install -U {opts} {packages}
basepython = python3
install_command = pip install -U \
{opts} {packages} \
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
@ -35,13 +38,10 @@ commands =
{[testenv:bashate]commands}
[testenv:flake8]
basepython = python3
description = Dummy environment to allow flake8 to be run in subdir tox
[testenv:pylint]
basepython = python3
description = Dummy environment to allow pylint to be run in subdir tox
[testenv:bandit]
basepython = python3
description = Dummy environment to allow bandit to be run in subdir tox