From 19f77a95f8a2c33c8977dd8fdf3dcbd421bd34ad Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Thu, 13 Apr 2023 17:14:01 +0000 Subject: [PATCH] Fix failing tox and zuul for cgtsclient The dependencies were failing to install mostly because this repo still has python2 for its tox and zuul. tox.ini has been updated, and zuul now points to a debian nodeset. Some of the components are newer, and therefore additional error checks are being suppressed for flake8 and pylint. Closes-Bug: #2016171 Signed-off-by: Al Bailey Change-Id: I0632ab4d4292a623a541109d4f53953113d59877 --- .zuul.yaml | 4 +- sysinv/cgts-client/cgts-client/pylint.rc | 121 +++--------------- .../cgts-client/test-requirements.txt | 10 +- sysinv/cgts-client/cgts-client/tox.ini | 36 +----- 4 files changed, 27 insertions(+), 144 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 8c5f115ee9..2ad42e5496 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -187,7 +187,7 @@ parent: tox description: | Run pep8 test for cgts-client - nodeset: ubuntu-bionic + nodeset: debian-bullseye files: - sysinv/cgts-client/* vars: @@ -199,7 +199,7 @@ parent: tox description: | Run pylint test for cgts-client - nodeset: ubuntu-xenial + nodeset: debian-bullseye files: - sysinv/cgts-client/* vars: diff --git a/sysinv/cgts-client/cgts-client/pylint.rc b/sysinv/cgts-client/cgts-client/pylint.rc index 955cfa31e5..bcc6c346c3 100755 --- a/sysinv/cgts-client/cgts-client/pylint.rc +++ b/sysinv/cgts-client/cgts-client/pylint.rc @@ -17,91 +17,6 @@ load-plugins= [MESSAGES CONTROL] -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -# -# Python3 checker: -# -# E1601: print-statement -# E1602: parameter-unpacking -# E1603: unpacking-in-except -# E1604: old-raise-syntax -# E1605: backtick -# E1606: long-suffix -# E1607: old-ne-operator -# E1608: old-octal-literal -# E1609: import-star-module-level -# E1610: non-ascii-bytes-literal -# E1611: invalid-unicode-literal -# W1601: apply-builtin -# W1602: basestring-builtin -# W1603: buffer-builtin -# W1604: cmp-builtin -# W1605: coerce-builtin -# W1606: execfile-builtin -# W1607: file-builtin -# W1608: long-builtin -# W1609: raw_input-builtin -# W1610: reduce-builtin -# W1611: standarderror-builtin -# W1612: unicode-builtin -# W1613: xrange-builtin -# W1614: coerce-method -# W1615: delslice-method -# W1616: getslice-method -# W1617: setslice-method -# W1618: no-absolute-import -# W1619: old-division -# W1620: dict-iter-method -# W1621: dict-view-method -# W1622: next-method-called -# W1623: metaclass-assignment -# W1624: indexing-exception -# W1625: raising-string -# W1626: reload-builtin -# W1627: oct-method -# W1628: hex-method -# W1629: nonzero-method -# W1630: cmp-method -# W1632: input-builtin -# W1633: round-builtin -# W1634: intern-builtin -# W1635: unichr-builtin -# W1636: map-builtin-not-iterating -# W1637: zip-builtin-not-iterating -# W1638: range-builtin-not-iterating -# W1639: filter-builtin-not-iterating -# W1640: using-cmp-argument -# W1641: eq-without-hash -# W1642: div-method -# W1643: idiv-method -# W1644: rdiv-method -# W1645: exception-message-attribute -# W1646: invalid-str-codec -# W1647: sys-max-int -# W1648: bad-python3-import -# W1649: deprecated-string-function -# W1650: deprecated-str-translate-call -# W1651: deprecated-itertools-function -# W1652: deprecated-types-field -# W1653: next-method-defined -# W1654: dict-items-not-iterating -# W1655: dict-keys-not-iterating -# W1656: dict-values-not-iterating -# W1657: deprecated-operator-function -# W1658: deprecated-urllib-function -# W1659: xreadlines-attribute -# W1660: deprecated-sys-function -# W1661: exception-escape -# W1662: comprehension-escape -enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, - W1651,W1649,W1657,W1660,W1658,W1659,W1623,W1622,W1620,W1621,W1645,W1641, - W1624,W1648,W1625,W1611,W1662,W1661,W1650,W1640,W1630,W1614,W1615,W1642, - W1616,W1628,W1643,W1629,W1627,W1644,W1617,W1601,W1602,W1603,W1604,W1605, - W1654,W1655,W1656,W1619,W1606,W1607,W1639,W1618,W1632,W1634,W1608,W1636, - W1653,W1646,W1638,W1609,W1610,W1626,W1633,W1647,W1635,W1612,W1613,W1637 - # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where @@ -114,37 +29,38 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # The following warnings are disabled and should be fixed: # fixme (notes, todo, xxx) # W0108: unnecessary-lambda -# W0110: deprecated-lambda # W0120: useless-else-on-loop # W0123: eval-used # W0212: protected-access # W0235: useless-super-delegation +# W3101: missing-timeout # W0402: deprecated-module -# W0403: relative-import +# W0602: global-variable-not-assigned # W0603: global-statement # W0611: unused-import # W0612: unused-variable # W0613: unused-argument # W0622: redefined-builtin # W0631: undefined-loop-variable -# W0703: broad-except +# W0707: raise-missing-from +# W0718: broad-exception-caught +# W0719: broad-exception-raised # W1401: anomalous-backslash-in-string +# W1514: unspecified-encoding # W1618: no-absolute-import -disable=C, R, fixme, W0108, W0110, W0120, W0123, - W0212, W0235, W0402, W0403, W0603, W0611, - W0612, W0613, W0622, W0631, W0703, W1401, - W1618 +# W4902: deprecated-method +# E0601: used-before-assignment !!! +disable=C, R, fixme, + W0108, W0120, W0123, W0212, W0235, W3101, + W0402, W0602, W0603, W0611, W0612, W0613, + W0622, W0631, W0707, W0718, W0719, W1401, W1514, + W4902, E0601 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs # (visual studio) and html output-format=text -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - # Tells whether to display a full report or only the messages reports=no @@ -179,10 +95,6 @@ indent-string=' ' [TYPECHECK] -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). ignored-classes=SQLObject @@ -194,9 +106,6 @@ generated-members=REQUEST,acl_users,aq_parent [BASIC] -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - # Regular expression which should only match correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ @@ -286,7 +195,7 @@ max-locals=15 max-returns=6 # Maximum number of branch for function / method body -max-branchs=12 +max-branches=12 # Maximum number of statements in function / method body max-statements=50 @@ -315,4 +224,4 @@ valid-classmethod-first-arg=cls [EXCEPTIONS] # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception diff --git a/sysinv/cgts-client/cgts-client/test-requirements.txt b/sysinv/cgts-client/cgts-client/test-requirements.txt index 7f4470e141..74ae66c8cd 100644 --- a/sysinv/cgts-client/cgts-client/test-requirements.txt +++ b/sysinv/cgts-client/cgts-client/test-requirements.txt @@ -3,11 +3,8 @@ # process, which may cause wedges in the gate later. # Newer hacking already pins down pep8, pyflakes and flake8 -flake8<3.8.0 -astroid<2.0;python_version<"3.0" # GPLv2 -astroid<= 2.2.5;python_version>="3.0" # GPLv2 -pycodestyle<2.6.0 # MIT License hacking>=1.1.0,<=2.0.0 # Apache-2.0 +astroid coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0 # BSD @@ -17,7 +14,8 @@ stestr testscenarios>=0.4 # Apache-2.0/BSD testtools>=1.4.0 # MIT testresources>=0.2.4 # Apache-2.0/BSD +flake8-bugbear httplib2 +isort<5 python-keystoneclient -pylint<2.1.0;python_version<"3.0" # GPLv2 -pylint<2.4.0;python_version>="3.0" # GPLv2 +pylint diff --git a/sysinv/cgts-client/cgts-client/tox.ini b/sysinv/cgts-client/cgts-client/tox.ini index abd67cf97f..e408e11254 100644 --- a/sysinv/cgts-client/cgts-client/tox.ini +++ b/sysinv/cgts-client/cgts-client/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py36,py39,pep8,pylint +envlist = py39,pep8,pylint minversion = 1.6 #skipsdist = True @@ -17,7 +17,7 @@ basepython = python3 usedevelop = True install_command = pip install \ -U \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/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} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt @@ -38,38 +38,14 @@ passenv = no_proxy NO_PROXY -[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 \ - -U \ - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ - {opts} {packages} -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -e{[tox]stxdir}/config/tsconfig/tsconfig commands = {[testenv]commands} stestr run {posargs} stestr slowest [testenv:pep8] -basepython = python3 -deps = -r{toxinidir}/test-requirements.txt - flake8-bugbear commands = flake8 cgtsclient @@ -77,7 +53,6 @@ commands = commands = {posargs} [testenv:cover] -basepython = python2.7 setenv = {[testenv]setenv} PYTHON=coverage run --parallel-mode commands = @@ -109,6 +84,7 @@ max-complexity=25 # B006 Do not use mutable data structures for argument defaults # B009 Do not call getattr with a constant attribute value # B010 Do not call setattr with a constant attribute value +# B028 No explicit stacklevel keyword argument found # -W- codes are warnings # W503 line break before binary operator # W504 line break after binary operator @@ -116,14 +92,14 @@ max-complexity=25 # -E- codes are errors # E501 line too long # E731 do not assign a lambda expression, use a def +# E741 ambiguous variable name # -F- codes are errors ignore = H102,H104,H105,H238,H404,H405, - B004,B005,B006,B009,B010, + B004,B005,B006,B009,B010,B028, W503,W504,W605, - E501,E731 + E501,E731,E741 [testenv:pylint] -basepython = python3 commands = pylint {posargs} cgtsclient --rcfile=./pylint.rc --extension-pkg-whitelist=lxml.etree,greenlet [testenv:bindep]