Files
distcloud-client/distributedcloud-client/tox.ini
BoYuan Chang b190ab3221 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
2022-08-11 14:16:40 -04:00

170 lines
4.9 KiB
INI

[tox]
minversion = 2.3
envlist = py27,py36,py39,pep8,pylint,pep8_Debian,pylint_Debian
skipsdist = True
toxworkdir = /tmp/{env:USER}_dc_client_tox
[dcclient]
client_base_dir = .
[testenv]
install_command = pip install \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
# DISCOVER_DIRECTORY=dcmanagerclient/tests
deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
whitelist_externals =
rm
find
reno
[testenv:py27]
basepython = python2.7
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
[testenv:py36]
basepython = python3.6
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
[testenv:py39]
skipdist = False
basepython = python3.9
install_command = pip install \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/victoria/upper-constraints.txt} \
{opts} {packages}
commands =
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
[testenv:pep8]
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
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}
[testenv:cover]
basepython = python3
setenv =
PYTHON=coverage run --parallel-mode
PYTHONDONTWRITEBYTECODE=True
deps = {[testenv]deps}
coverage
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: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}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# W504 line break after binary operator
# W605 invalid escape sequence
show-source = True
ignore = E123,E125,W504,W605,H102
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:linters]
basepython = python3
# bashate ignore:
# E006 - accept long lines
# E040 - false positive on |& syntax (new in bash 4)
whitelist_externals = bash
commands =
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint"
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
whitelist_externals = rm
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
whitelist_externals =
rm
reno
[testenv:newnote]
basepython = python3
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno new {posargs}