config/sysinv/sysinv/sysinv/tox.ini

179 lines
6.0 KiB
INI

[tox]
envlist = flake8,py27
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
wrsdir = {toxinidir}/../../../../../../../../..
cgcsdir = {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.
# WRS 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{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
# Note the hash seed is set to 0 until can be tested with a
# random hash seed successfully.
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}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig
-e{[tox]cgcsdir}/stx-config/configutilities/configutilities
-e{[tox]cgcsdir}/stx-fault/fm-api
-e{[tox]cgcsdir}/stx-fault/python-fmclient/fmclient
-e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util
commands =
find . -type f -name "*.pyc" -delete
# TODO: remove ignore E722 when issue 8174 is resolved
# F series are flake8. All should be fixed
# F821 undefined name 'exc'
# F841 local variable 'response' is assigned to but never used
# E series are pep8
# E116 unexpected indentation (comment)
# E121 continuation line under-indented for hanging indent
# E126 continuation line over-indented for hanging indent
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# E203 whitespace before ':'
# E231 missing whitespace after ','
# E266 too many leading '#' for block comment
# E402 module level import not at top of file
# E501 line too long > 80
# E702 multiple statements on one line (semicolon)
# E711 comparison to None should be 'if cond is not None:'
# E712 comparison to True should be 'if cond is True:' or 'if cond:'
# E713 test for membership should be 'not in'
# E714 test for object identity should be 'is not'
# E722 do not use bare except
# E731 do not assign a lambda expression, use a def
# H series are hacking
# H101 is TODO
# H102 is apache license
# H104 file contains only comments (ie: license)
# H105 author tags
# H231..H238 are python3 compatability
# H401,H403,H404,H405 are docstring and not important
[flake8]
ignore = E501,E127,E128,E402,E126,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405
builtins = _
[testenv:flake8]
basepython = python2.7
deps = flake8
commands =
flake8 {posargs} . \
sysinv/cmd/manage-partitions \
sysinv/cmd/query_pci_id \
sysinv/cluster/cluster_services_dump
[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}
-e{[tox]cgcsdir}/stx-update/tsconfig/tsconfig
-e{[tox]cgcsdir}/stx-config/configutilities/configutilities
-e{[tox]cgcsdir}/stx-fault/fm-api
-e{[tox]cgcsdir}/stx-config/controllerconfig/controllerconfig
-e{[tox]cgcsdir}/stx-update/cgcs-patch/cgcs-patch
-e{[tox]cgcsdir}/stx-integ/utilities/platform-util/platform-util
commands =
find . -type f -name "*.pyc" -delete
find . -type f -name ".coverage\.*" -delete
coverage erase
python tools/patch_tox_venv.py
python setup.py testr --coverage --testr-args='{posargs}'
coverage xml
[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