Files
config/controllerconfig/controllerconfig/tox.ini
T
albailey ddeed8d916 Fix tox certificate issues in python2
Python2 tox jobs may fail due to expired CA certificates.
The workaround is to explicitly set an environment variable.
This env variable is only passed to python2.7 targets.

If a developer is not currently blocked by certificate failures
then they do not need to set anything.

Ex:
CURL_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

The py files are only updated to trigger the appropriate zuul
tox jobs.

Story: 2008943
Task: 44007
Signed-off-by: albailey <Al.Bailey@windriver.com>
Change-Id: Iba6c251368e41cd6a34dd4be4138f5eb4ad3804c
2021-11-18 15:14:51 -06:00

93 lines
2.5 KiB
INI

# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist = flake8, pylint, py27, py36, py39
# Tox does not work if the path to the workdir is too long, so move it to /tmp
toxworkdir = /tmp/{env:USER}_cctox
stxdir = {toxinidir}/../../..
[testenv]
whitelist_externals = find
install_command = pip install \
--no-cache-dir \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/fault/fm-api/source
-e{[tox]stxdir}/config/tsconfig/tsconfig
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
commands =
find . -type f -name "*.pyc" -delete
[testenv:venv]
commands = {posargs}
[testenv:py27]
basepython = python2.7
deps = {[testenv]deps}
passenv = CURL_CA_BUNDLE
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
deps = {[testenv]deps}
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pylint]
basepython = python3
deps = {[testenv]deps}
pylint
commands = pylint {posargs} controllerconfig --rcfile=./pylint.rc --extension-pkg-whitelist=netifaces
[testenv:flake8]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = flake8 {posargs}
[testenv:py39]
basepython = python3.9
install_command = pip install \
--no-cache-dir \
-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}
stestr slowest
[flake8]
# H series are hacking
# H101: Use TODO(NAME)
# H102: Apache 2.0 license header not found
# H104: File contains nothing but comments
# H306: imports not in alphabetical order
# H401: docstring should not start with a space
# H404: multi line docstring should start without a leading new line
# H405: multi line docstring summary not separated with an empty line
ignore = H101,H102,H104,H306,H401,H404,H405
exclude = build
[testenv:cover]
basepython = python3
deps = {[testenv]deps}
commands =
coverage erase
python setup.py testr --coverage --testr-args='{posargs}'
coverage xml
coverage report