Update tox path for python3

- The reference to cgcs_patch was the older centos python2
location, and has now bee updated to the python3 debian
package.

- Removed 'legacy-resolver' from the pip install command.

- The basepython is now python3 and the upper-constraints
for debian and python3 are now specified.

- The older python2 to 3 conversion directives in pylint
have been removed, and only the errors that are currently
valid are being suppressed.

- The python2 vs python3 requirements are now updated to
only reflect python3.

- The zuul job for pylint specifies the debian nodeset.

- override tox constraints file to use the STX constraints
  This means starlingx/root needs to be a required project

None of these changes have any runtime effect.
These changes only affect tox and zuul.

Test Plan:
  PASS: tox

Story: 2010642
Task: 47916
Change-Id: I1cd8a78e5e26efc4b3d4b346749735e4de9f6016
Signed-off-by: Al Bailey <al.bailey@windriver.com>
This commit is contained in:
Al Bailey 2023-05-01 13:23:05 +00:00
parent db9bb2cf03
commit 5fff425f25
4 changed files with 18 additions and 114 deletions

View File

@ -23,8 +23,10 @@
name: stx-gui-pylint
parent: openstack-tox-pylint
description: Run pylint for stx-gui
nodeset: debian-bullseye
vars:
tox_envlist: pylint
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/starlingx/root/build-tools/requirements/debian/upper-constraints.txt' # yamllint disable-line rule:line-length
tox_environment:
STX_DC_CLIENT: distcloud-client
required-projects:
@ -33,6 +35,7 @@
- starlingx/fault
- starlingx/ha
- starlingx/nfv
- starlingx/root
- starlingx/update
- starlingx/utilities

View File

@ -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
@ -111,21 +26,15 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W0212 protected-access var starting with _ used outside class or descendant
# W0221 arguments-differ
# W0235 useless-super-delegation
# W0403 relative-import warning
# W0511 fixme
# W0613 Unused argument warning
# W0703 broad except warning
# W1618: no-absolute-import
# E0202 method-hidden
# E0203 access-member-before-definition
# E1101 no-member
# The next two error codes are because Django 1.11.20 cannot be specified
# without a custom upper constraints file
# E0401: Unable to import 'django.core.urlresolvers' (import-error)
# E0611: No name 'urlresolvers' in module 'django.core' (no-name-in-module)
disable=C, R, W0107, W0201, W0212, W0221, W0235,
W0403, W0511, W0613, W0703, W1618,
E0202, E0203, E1101, E0401, E0611
disable=C, R,
W0107, W0201, W0212, W0221, W0235, W0511, W0613, W0703,
E0202, E0203, E1101
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -23,8 +23,8 @@ testtools>=1.4.0 # MIT
# This also needs xvfb library installed on your OS
xvfbwrapper>=0.1.3 #license: MIT
pyOpenSSL>=0.14
bandit;python_version>="3.0"
isort<5;python_version>="3.0"
pylint<2.1.0;python_version<"3.0" # GPLv2
pylint<2.4.0;python_version>="3.0" # GPLv2
bandit
isort<5
pylint<2.4.0
Django
yamllint

24
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = pep8,pylint
envlist = pep8,linters,pylint
minversion = 2.3
skipsdist = True
stxdir = {toxinidir}/..
@ -7,9 +7,10 @@ stxdir = {toxinidir}/..
# Note: STX_DC_CLIENT is set by zuul to be distcloud-client, it is
# defaulted here to the path that works in developer environments
[testenv]
basepython = python3
install_command = pip install \
-v -v -v --use-deprecated legacy-resolver \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
-v -v -v \
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
setenv = VIRTUAL_ENV={envdir}
@ -18,9 +19,9 @@ setenv = VIRTUAL_ENV={envdir}
OS_TEST_TIMEOUT=60
STX_DC_CLIENT = {env:STX_DC_CLIENT:distributedcloud-client}
deps = -r{toxinidir}/test-requirements.txt
usedevelop = False
[testenv:linters]
basepython = python3
allowlist_externals = bash
commands =
bash -c "find {toxinidir} \
@ -31,7 +32,7 @@ commands =
-name \*.sh \
-print0 | xargs --no-run-if-empty -0 bashate -v"
bash -c "find {toxinidir} \
-o \( -name .tox -prune \) \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs --no-run-if-empty -0 yamllint"
@ -47,24 +48,20 @@ ignore = H102,W503,W504,E741
enable-extensions = H106,H203,H904
[testenv:pep8]
basepython = python3
usedevelop = False
skip_install = True
commands =
flake8
[testenv:pylint]
basepython = python3
usedevelop = False
skip_install = True
deps = {[testenv]deps}
-e{[tox]stxdir}/{env:STX_DC_CLIENT}/distributedcloud-client
-e{[tox]stxdir}/config/sysinv/cgts-client/cgts-client
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
-e{[tox]stxdir}/fault/python-fmclient/fmclient
-e{[tox]stxdir}/update/cgcs-patch/cgcs-patch
-e{[tox]stxdir}/nfv/nfv/nfv-client
-e{[tox]stxdir}/ha/service-mgmt-client/sm-client
-e{[tox]stxdir}/nfv/nfv/nfv-client
-e{[tox]stxdir}/update/sw-patch/cgcs-patch
-e{[tox]stxdir}/utilities/ceph/python-cephclient/python-cephclient
horizon
requests-toolbelt
@ -72,11 +69,9 @@ commands =
pylint starlingx-dashboard/starlingx-dashboard/starlingx_dashboard --rcfile=./pylint.rc
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
install_command = pip install -U {opts} {packages}
commands =
@ -85,7 +80,6 @@ commands =
allowlist_externals = rm
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
install_command = pip install -U {opts} {packages}
commands =
@ -96,7 +90,6 @@ allowlist_externals =
reno
[testenv:newnote]
basepython = python3
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
@ -104,6 +97,5 @@ install_command = pip install -U {opts} {packages}
commands = reno new {posargs}
[testenv:bandit]
basepython = python3
description = Bandit code scan for *.py files under config folder
commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll