Make Tox compatible to Debian Python3.9 Environment - dc-client

The pylint setup related to pip and upper constraints
is different for python3.9. Updated the requirement packages'
software version (to versions that support python3.9) Updated
'cover' tox.ini target to be python3.9

These alarms are suppressed because python2 does not support the
suggested syntax, will be unsuppressed after termination of python2

  W0707: raise-missing-from
  W1514: unspecified-encoding

Test Plan :

1. Ensure Tox can pass on both Debain and CentOS build server
2. Ensure pylint3 and pylint3.9 can pass without warning

Signed-off-by: BoYuan Chang <boyuan.chang@windriver.com>
Story: 2008943
Task: 45941
Change-Id: I4981b98002f5842df9fec31a3991916b84592c07
This commit is contained in:
BoYuan Chang 2022-08-02 16:09:11 -04:00
parent 84895c499e
commit b190ab3221
4 changed files with 100 additions and 11 deletions

View File

@ -11,6 +11,8 @@
- stx-distcloud-client-tox-py27
- stx-distcloud-client-tox-py39
- stx-distcloud-client-tox-pylint
- stx-distcloud-client-tox-pep8-debian
- stx-distcloud-client-tox-pylint-debian
gate:
jobs:
- openstack-tox-linters
@ -18,6 +20,8 @@
- stx-distcloud-client-tox-py27
- stx-distcloud-client-tox-py39
- stx-distcloud-client-tox-pylint
- stx-distcloud-client-tox-pep8-debian
- stx-distcloud-client-tox-pylint-debian
post:
jobs:
- stx-distcloud-client-upload-git-mirror
@ -48,6 +52,16 @@
tox_envlist: pylint
tox_extra_args: -c distributedcloud-client/tox.ini
- job:
name: stx-distcloud-client-tox-pylint-debian
parent: tox
description: Run pylint with py39 for distcloud-client
nodeset: ubuntu-focal
vars:
python_version: 3.9
tox_envlist: pylint_Debian
tox_extra_args: -c distributedcloud-client/tox.ini
- job:
name: stx-distcloud-client-tox-pep8
parent: tox
@ -57,6 +71,16 @@
tox_envlist: pep8
tox_extra_args: -c distributedcloud-client/tox.ini
- job:
name: stx-distcloud-client-tox-pep8-debian
parent: tox
description: Run pep8 for py39 distcloud client
nodeset: ubuntu-focal
vars:
python_version: 3.9
tox_envlist: pep8_Debian
tox_extra_args: -c distributedcloud-client/tox.ini
- job:
name: stx-distcloud-client-upload-git-mirror
parent: upload-git-mirror

View File

@ -20,6 +20,10 @@ persistent=yes
# usually to register additional checkers.
load-plugins=
# TODO: Bo remove the following once we no longer use python2
# Remove option files-output, bad-functions, max-branches
# Remove E1606, E1607, E1608, E1610, E1611, E1641, W0403, W1112, W1641
# Remove enable section since python3 checker will then by default
[MESSAGES CONTROL]
# Enable the message, report, category or checker with the given id(s). You can
@ -100,12 +104,12 @@ load-plugins=
# 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
enable=E1601,E1602,E1603,E1604,E1605,E1606,E1607,E1608,E1609,E1610,E1611,W1601,
W1602,W1603,W1604,W1605,W1606,W1607,W1608,W1609,W1610,W1611,W1612,W1613,
W1614,W1615,W1616,W1617,W1618,W1619,W1620,W1621,W1622,W1623,W1624,W1625,
W1626,W1627,W1628,W1629,W1630,W1632,W1633,W1634,W1635,W1636,W1637,W1638,
W1639,W1640,W1641,W1642,W1643,W1644,W1645,W1646,W1647,W1648,W1649,W1650,
W1651,W1652,W1653,W1654,W1655,W1656,W1657,W1658,W1659,W1660,W1661,W1662
# 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
@ -115,6 +119,7 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
#
# R detect Refactor for a "good practice" metric violation
# C detect Convention for coding standard violation
# E1102: not-callable
# W0107: unnecessary-pass
# W0212: protected-access
# W0403: relative-import (typically caused by six)
@ -125,11 +130,15 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W1113: keyword-arg-before-vararg
# W1505: deprecated-method
# W1618: no-absolute-import
# E1102: not-callable
#
# Following alarms are suppressed because python2 does not support the new pylint
# suggested syntax change. Need to unsuppress once we move away from python2
# W0707: raise-missing-from
# W1514: unspecified-encoding
#
disable=C,R,
W0107,W0212,W0403,
W0612,W0613,W0603,W0622,W0703,W1112,W1505,W1618,
E1102
E1102,W0107,W0212,W0403,W0612,W0613,W0603,
W0622,W0703,W0707,W1112,W1505,W1514,W1618
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -0,0 +1,20 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.1.0,<=2.0.0 # Apache-2.0
astroid==2.11.5;python_version>"3.7" # GPLv2
isort<5;python_version>="3.5"
pylint==2.14.1;python_version>"3.7" # GPLv2
python-openstackclient>=3.3.0 # Apache-2.0
sphinx>=1.5.1;python_version<="3.6" # BSD
sphinx>=1.6.2;python_version>="3.6" # BSD
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0 # BSD
tempest>=14.0.0 # Apache-2.0
testtools>=1.4.0 # MIT
PyYAML>=3.1.0
yamllint<1.26.1;python_version>="3.0" # GPLv2
python-dev-tools;python_version>="3.9"
beautifulsoup4;python_version>="3.9"
osprofiler;python_version>="3.8"
requests_toolbelt;python_version>="3.0"

View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.3
envlist = py27,py36,py39,pep8,pylint
envlist = py27,py36,py39,pep8,pylint,pep8_Debian,pylint_Debian
skipsdist = True
toxworkdir = /tmp/{env:USER}_dc_client_tox
@ -53,6 +53,14 @@ basepython = python3
deps = {[testenv]deps}
commands = flake8 {posargs}
[testenv:pep8_Debian]
basepython = python3.9
deps = -r{toxinidir}/test-requirements-debian.txt
install_command = pip install -v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
commands = flake8
[testenv:pylint]
basepython = python3
sitepackages = False
@ -60,6 +68,15 @@ deps = {[testenv]deps}
commands =
pylint {posargs} dcmanagerclient --rcfile=./pylint.rc
[testenv:pylint_Debian]
basepython = python3.9
deps = -r{toxinidir}/test-requirements-debian.txt
install_command = pip install -v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
commands =
pylint {posargs} dcmanagerclient --rcfile=./pylint.rc
[testenv:venv]
basepython = python3
commands = {posargs}
@ -82,6 +99,25 @@ commands =
coverage xml -o cover/coverage.xml
coverage report
[testenv:cover_Debian]
basepython = python3.9
setenv =
PYTHON=coverage run --parallel-mode
PYTHONDONTWRITEBYTECODE=True
deps = -r{toxinidir}/test-requirements-debian.txt
coverage
install_command = pip install -v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
coverage erase
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}