config/sysinv/sysinv/sysinv/tox.ini

174 lines
5.6 KiB
INI

[tox]
envlist = flake8,py27,py35,pylint
minversion = 1.6
# skipsdist = True
#,pip-missing-reqs
# tox does not work if the path to the workdir is too long, so move it to /tmp
toxworkdir = /tmp/{env:USER}_sysinvtox
stxdir = {toxinidir}/../../../..
distshare={toxworkdir}/.tox/distshare
[testenv]
# usedevelop = True
# enabling usedevelop results in py27 develop-inst:
# Exception: Versioning for this project requires either an sdist tarball,
# or access to an upstream git repository.
# Note. site-packages is true and rpm-python must be yum installed on your dev machine.
sitepackages = True
# tox is silly... these need to be separated by a newline....
whitelist_externals = bash
find
install_command = pip install \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
# Note the hash seed is set to 0 until can be tested with a
# random hash seed successfully.
# Note: Developers can leave STX_PREFIX unset in their env, and it will default to "stx-".
# Zuul sets STX_PREFIX to an empty string.
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
PYTHONDONTWRITEBYTECODE=1
OS_TEST_PATH=./sysinv/tests
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
EVENTS_YAML=./sysinv/tests/events_for_testing.yaml
SYSINV_TEST_ENV=True
TOX_WORK_DIR={toxworkdir}
PYLINTHOME={toxworkdir}
STX_PREFIX = {env:STX_PREFIX:stx-}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/{env:STX_PREFIX}update/tsconfig/tsconfig
-e{[tox]stxdir}/{env:STX_PREFIX}fault/fm-api
-e{[tox]stxdir}/{env:STX_PREFIX}fault/python-fmclient/fmclient
-e{[tox]stxdir}/{env:STX_PREFIX}config/controllerconfig/controllerconfig
-e{[tox]stxdir}/{env:STX_PREFIX}update/cgcs-patch/cgcs-patch
-e{[tox]stxdir}/{env:STX_PREFIX}integ/utilities/platform-util/platform-util
commands =
find . -type f -name "*.pyc" -delete
[flake8]
# Note: hacking pulls in flake8 2.5.5 which can not parse an ignore list spanning multiple lines
# E series are pep8
# E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# E226 missing whitespace around arithmetic operator
# E402 module level import not at top of file
# E501 line too long > 80
# H series are hacking
# H101 is TODO
# H102 is apache license
# H104 file contains only comments (ie: license)
# H105 author tags
# H306 imports not in alphabetical order
# H401 docstring should not start with a space
# H403 multi line docstrings should end on a new line
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# H701 Empty localization string
# H702 Formatting operation should be outside of localization method call
# H703 Multiple positional placeholders
ignore = E126,E127,E128,E226,E402,E501,H101,H102,H104,H105,H306,H401,H403,H404,H405,H701,H702,H703
exclude = build,dist,tools
[testenv:flake8]
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt
commands =
flake8 {posargs} . \
sysinv/cmd/manage-partitions \
sysinv/cmd/query_pci_id
[testenv:py27]
basepython = python2.7
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py35]
basepython = python3.5
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
# testenv:flake8 clone
basepython = {[testenv:flake8]basepython}
deps = {[testenv:flake8]deps}
commands = {[testenv:flake8]commands}
[testenv:venv]
commands = {posargs}
[bandit]
# The following bandit tests are being skipped:
# B101: Test for use of assert
# B104: Test for binding to all interfaces
# B107: Test for use of hard-coded password argument defaults
# B108: Probable insecure usage of temp file/directory
# B110: Try, Except, Pass detected.
# B111: Execute with run_as_root=True identified, possible security issue
# B310: Audit url open for permitted schemes
# B311: Standard pseudo-random generators are not suitable for security/cryptographic purposes
# B404: Import of subprocess module
# B410: Import of lxml module
# B504: Test for SSL use with no version specified
# B506: Test for use of yaml load
# B603: Test for use of subprocess with shell equals true
# B607: Test for starting a process with a partial path
skips = B101,B104,B107,B108,B110,B111,B310,B311,B404,B410,B504,B506,B603,B607
exclude = tests
[testenv:bandit]
basepython = python2.7
deps = {[testenv]deps}
bandit
commands = bandit --ini tox.ini -n 5 -f xml -o bandit.xml -r sysinv
[testenv:pylint]
basepython = python2.7
sitepackages = False
deps = {[testenv]deps}
pylint
commands =
pylint {posargs} sysinv --rcfile=./pylint.rc --extension-pkg-whitelist=lxml.etree,greenlet
[testenv:cover]
basepython = python2.7
deps = {[testenv]deps}
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands =
{[testenv]commands}
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:pip-missing-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages
# this also means that pip-missing-reqs must be installed separately, outside
# of the requirements.txt files
deps = pip_missing_reqs
-rrequirements.txt
commands=pip-missing-reqs -d --ignore-file=/sysinv/tests sysinv