e3be9a2776
To prevent the warning about a newer version of pip available, the following env setting was added PIP_DISABLE_PIP_VERSION_CHECK=1 To prevent sub-calls to tox from using the default pip cache location, rather than whatever a user may override using xdg env variables, the following has been added: passenv = XDG_CACHE_HOME The python patch scripts are now validated by flake8. All flake8 tox targets are triggered from a single zuul job. Story: 2004515 Task: 38581 Change-Id: I105512edbd3da15480355e30c0dd14933584a47b Signed-off-by: albailey <Al.Bailey@windriver.com>
138 lines
4.0 KiB
INI
138 lines
4.0 KiB
INI
#
|
|
# Copyright (c) 2019 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
[tox]
|
|
envlist = flake8,py27,py36,pylint,cover
|
|
minversion = 2.3.2
|
|
skipsdist = True
|
|
|
|
stxdir = {toxinidir}/../../..
|
|
|
|
[testenv]
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
LANG=en_US.UTF-8
|
|
LANGUAGE=en_US:en
|
|
LC_ALL=C
|
|
OS_STDERR_CAPTURE=1
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_TEST_PATH=./cgcs_patch/tests
|
|
OS_TEST_TIMEOUT=60
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
PYTHONHASHSEED=0
|
|
PYTHONWARNINGS=default::DeprecationWarning
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
passenv =
|
|
XDG_CACHE_HOME
|
|
|
|
sitepackages = False
|
|
install_command = pip install \
|
|
-v -v -v \
|
|
-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
|
|
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
|
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
|
|
|
whitelist_externals = find
|
|
sh
|
|
|
|
[testenv:stestr]
|
|
commands =
|
|
find . -name "*.pyc" -delete
|
|
stestr run {posargs}
|
|
stestr slowest
|
|
|
|
[testenv:py27]
|
|
basepython = python2.7
|
|
commands = {[testenv:stestr]commands}
|
|
|
|
[testenv:py36]
|
|
basepython = python3.6
|
|
commands = {[testenv:stestr]commands}
|
|
|
|
[bandit]
|
|
# B101: Test for use of assert
|
|
# B104: Test for binding to all interfaces
|
|
# B110: Try, Except, Pass detected.
|
|
# B303: Use of insecure MD2, MD4, MD5, or SHA1 hash function.
|
|
# B311: Standard pseudo-random generators are not suitable for security/cryptographic purposes
|
|
# B314: Blacklisted calls to xml.etree.ElementTree
|
|
# B318: Blacklisted calls to xml.dom.minidom
|
|
# B404: Import of subprocess module
|
|
# B405: import xml.etree
|
|
# B408: import xml.minidom
|
|
# B413: import pyCrypto
|
|
# B506: Test for use of yaml load
|
|
# B602: Test for use of popen with shell equals true
|
|
# B603: Test for use of subprocess without shell equals true
|
|
# B607: Test for starting a process with a partial path
|
|
skips = B101,B104,B110,B303,B311,B314,B318,B404,B405,B408,B413,B506,B602,B603,B607
|
|
exclude = tests
|
|
|
|
[testenv:bandit]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
bandit
|
|
commands = bandit --ini tox.ini -n 5 -r cgcs_patch
|
|
|
|
[flake8]
|
|
# ignore below errors , will fix flake8 errors in future
|
|
# H101 Use TODO(NAME)
|
|
# H102 Apache 2.0 license header not found
|
|
# H105 Don't use author tags
|
|
# 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
|
|
# Note: W503 and W504 are mutually exclusive. Must select one of them to suppress.
|
|
# W504 line break after binary operator
|
|
# E501 line too long. skipped because some of the code files include templates
|
|
# that end up quite wide
|
|
# F401 'XXXXX' imported but unused
|
|
show-source = True
|
|
ignore = H101,H102,H105,H306,H401,H404,H405,
|
|
W504,E501,F401
|
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
|
# H106: Don't put vim configuration in source files (off by default).
|
|
# H203: Use assertIs(Not)None to check for None (off by default).
|
|
# (todo) enable H904 Delay string interpolations at logging calls (off by default)
|
|
enable-extensions = H106 H203
|
|
max-line-length = 120
|
|
|
|
[testenv:flake8]
|
|
basepython = python3
|
|
deps = {[testenv]deps}
|
|
flake8-bugbear
|
|
usedevelop = False
|
|
#skip_install = True
|
|
commands =
|
|
flake8 {posargs} .
|
|
|
|
[testenv:pylint]
|
|
basepython = python3
|
|
deps = {[testenv]deps}
|
|
pylint
|
|
sitepackages = False
|
|
commands = pylint cgcs_patch --rcfile=./pylint.rc
|
|
pylint cgcs_make_patch --rcfile=./pylint_make_patch.rc
|
|
|
|
[testenv:cover]
|
|
setenv =
|
|
PYTHON=coverage run --parallel-mode
|
|
PYTHONDONTWRITEBYTECODE=True
|
|
|
|
commands = coverage erase
|
|
find . -name "*.pyc" -delete
|
|
stestr run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report
|