527faa0113
- Replace mox with mox3 to support python3 - Change 'lambda (x, y): y - x' to 'lambda xy: xy[1] - xy[0]' - Change iter to list for str operator - Change urlparse to compatible python 2/3 - Adapt gettextutils - Fix 'TypeError: unorderable types: NoneType() < int()' for python3 - Change dict key to list - Change some requirement and test requirement remove MySQL-python remove Cheetah remove version limitation <3.0.0 for python-ldap - Fix encode/decode issue - Avoid exception for obj_load_attr with optional fields - Remove test_hash_file test case since it was never used. - Use mock not CreateMockAnything to mock contentmanager - Fix UnboundLocalError issue for python3 - Replace self.stubs.Set with stub_out - Change e.message to str(e) in exception block - Add self.mox.UnsetStubs() before self.mox.VerifyAll() - Fix set() order dismatch for python 2/3 - Implement nested for context manager in python 3 - Change migration version of sqlalchemy from 0 in python 3 - Avoid expose exception for db not connected - change hasattr(obj,attr) to getattr(obj,attr,None) since hasattr shadows all exception in python2.7 - Avoid sqlalchemy.orm.exc.DetachedInstanceError in get_networks Story: 2003433 Task: 28354 Depends-on: I4c601a72232402e45fe70e0d29de031ff294a4d7 Change-Id: I8382eba1bc3c91ca63d93e759021149914b12865 Signed-off-by: Sun Austin <austin.sun@intel.com>
169 lines
5.5 KiB
INI
169 lines
5.5 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{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]stxdir}/stx-update/tsconfig/tsconfig
|
|
-e{[tox]stxdir}/stx-config/configutilities/configutilities
|
|
-e{[tox]stxdir}/stx-fault/fm-api
|
|
-e{[tox]stxdir}/stx-fault/python-fmclient/fmclient
|
|
-e{[tox]stxdir}/stx-config/controllerconfig/controllerconfig
|
|
-e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch
|
|
-e{[tox]stxdir}/stx-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
|
|
# H232..H238 are python3 compatability
|
|
# 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
|
|
# H501 Do not use self.__dict__ for string formatting
|
|
# 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,H236,H237,H238,H306,H401,H403,H404,H405,H501,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 \
|
|
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}
|
|
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
|