138 lines
3.5 KiB
INI
138 lines
3.5 KiB
INI
#
|
|
# Copyright (c) 2019 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
[tox]
|
|
envlist = flake8,py27,py36,py39,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=./patch_alarm/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}/config/sysinv/sysinv/sysinv
|
|
-e{[tox]stxdir}/fault/fm-api
|
|
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
|
-e{[tox]stxdir}/update/cgcs-patch/cgcs-patch
|
|
|
|
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}
|
|
|
|
[testenv:py39]
|
|
basepython = python3.9
|
|
install_command = pip install \
|
|
-v -v -v \
|
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
|
{opts} {packages}
|
|
{opts} {packages}
|
|
|
|
deps = -r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
|
-e{[tox]stxdir}/fault/fm-api
|
|
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
|
-e{[tox]stxdir}/update/cgcs-patch/cgcs-patch
|
|
commands =
|
|
find . -name "*.pyc" -delete
|
|
stestr run {posargs}
|
|
stestr slowest
|
|
|
|
|
|
|
|
[bandit]
|
|
exclude = tests
|
|
|
|
[testenv:bandit]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
bandit
|
|
commands = bandit --ini tox.ini -n 5 -r patch_alarm
|
|
|
|
[flake8]
|
|
# ignore below errors , will fix flake8 errors in future
|
|
# H102 Apache 2.0 license header not found
|
|
# 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
|
|
show-source = True
|
|
ignore = H102,H306,H401,H404,H405
|
|
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).
|
|
# enable: H904 Delay string interpolations at logging calls (off by default).
|
|
enable-extensions = H106 H203 H904
|
|
max-line-length = 120
|
|
|
|
|
|
[testenv:flake8]
|
|
basepython = python3
|
|
deps = {[testenv]deps}
|
|
flake8-bugbear
|
|
usedevelop = False
|
|
#skip_install = True
|
|
commands =
|
|
flake8 {posargs} .
|
|
|
|
[testenv:pylint]
|
|
deps = {[testenv]deps}
|
|
pylint
|
|
|
|
basepython = python2.7
|
|
sitepackages = False
|
|
|
|
commands = pylint patch_alarm --rcfile=./pylint.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
|