diff --git a/.zuul.yaml b/.zuul.yaml index 9ca7103..643d27e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -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: diff --git a/python-k8sapp-platform/k8sapp_platform/pylint.rc b/python-k8sapp-platform/k8sapp_platform/pylint.rc index 3450569..e1e3ccd 100755 --- a/python-k8sapp-platform/k8sapp_platform/pylint.rc +++ b/python-k8sapp-platform/k8sapp_platform/pylint.rc @@ -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 diff --git a/python-k8sapp-platform/k8sapp_platform/setup.cfg b/python-k8sapp-platform/k8sapp_platform/setup.cfg index 396a228..71304dd 100644 --- a/python-k8sapp-platform/k8sapp_platform/setup.cfg +++ b/python-k8sapp-platform/k8sapp_platform/setup.cfg @@ -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 diff --git a/python-k8sapp-platform/k8sapp_platform/tox.ini b/python-k8sapp-platform/k8sapp_platform/tox.ini index af21200..821c608 100644 --- a/python-k8sapp-platform/k8sapp_platform/tox.ini +++ b/python-k8sapp-platform/k8sapp_platform/tox.ini @@ -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 diff --git a/tox.ini b/tox.ini index 27a7250..97252e8 100644 --- a/tox.ini +++ b/tox.ini @@ -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