[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}/tsconfig/tsconfig -e{[tox]cgcsdir}/configutilities/configutilities -e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api -e{[tox]cgcsdir}/controllerconfig/controllerconfig -e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch -e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util -e{[tox]avsdir}/python-vswitchclient commands = find . -type f -name "*.pyc" -delete python tools/patch_tox_venv.py python setup.py testr --testr-args='{posargs}' #py.test {posargs} # TODO: remove ignore E722 when issue 8174 is resolved # F series are flake8. All should be fixed # F401 'sysinv.common.exception' imported but unused # F403 'from netaddr import *' used; unable to detect undefined names # 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 = F403,F401,F821,F841,E501,E127,E128,E231,E266,E402,E711,E116,E203,E731,E712,E713,E702,E714,E126,E121,E722,H101,H102,H104,H105,H231,H232,H233,H234,H235,H236,H237,H238,H401,H403,H404,H405 [testenv:flake8] basepython = python2.7 deps = flake8 commands = flake8 {posargs} [testenv:py27] basepython = python2.7 [testenv:pep8] basepython = python2.7 deps = flake8 commands = flake8 {posargs} [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 excludes = tests [testenv:bandit] basepython = python2.7 deps = {[testenv]deps} -e{[tox]cgcsdir}/tsconfig/tsconfig -e{[tox]cgcsdir}/configutilities/configutilities -e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api -e{[tox]cgcsdir}/controllerconfig/controllerconfig -e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch -e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util -e{[tox]cgcsdir}/sysinv/cgts-client/cgts-client -e{[tox]avsdir}/python-vswitchclient bandit commands = bandit --ini tox.ini -f xml -o bandit.xml -r sysinv -x tests --skip B101,B104,B107,B108,B110,B111,B310,B311,B404,B410,B504,B506,B603,B607 [testenv:pylint] basepython = python2.7 deps = {[testenv]deps} -e{[tox]cgcsdir}/middleware/config/recipes-common/tsconfig/tsconfig -e{[tox]cgcsdir}/middleware/config/recipes-control/configutilities/configutilities -e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api -e{[tox]cgcsdir}/middleware/config/recipes-control/controllerconfig/controllerconfig -e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch -e{[tox]cgcsdir}/middleware/util/recipes-common/platform-util/platform-util -e{[tox]cgcsdir}/middleware/sysinv/recipes-common/cgts-client/cgts-client 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}/middleware/config/recipes-common/tsconfig/tsconfig -e{[tox]cgcsdir}/middleware/config/recipes-control/configutilities/configutilities -e{[tox]cgcsdir}/middleware/fault/recipes-common/fm-api -e{[tox]cgcsdir}/middleware/config/recipes-control/controllerconfig/controllerconfig -e{[tox]cgcsdir}/middleware/patching/recipes-common/cgcs-patch/cgcs-patch -e{[tox]cgcsdir}/middleware/util/recipes-common/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