6f68610806
Enable F841 flake8 check 'variables assigned but unused'. This primarily involved removing the variable or renaming it as '_' to indicate it is an unused variable. There should be no runtime difference from these changes. Test Plan: PASS: tox PASS: sw-manager strategy creation (CLI commands) Story: 2010531 Task: 47606 Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I2431fe0c0ec7d6e01ab72668efc20c9c5e77e88f
153 lines
4.7 KiB
INI
153 lines
4.7 KiB
INI
#
|
||
# Copyright (c) 2018-2023 Wind River Systems, Inc.
|
||
#
|
||
# SPDX-License-Identifier: Apache-2.0
|
||
#
|
||
|
||
# Tox (http://tox.testrun.org/) is a tool for running tests
|
||
# in multiple virtualenvs. This configuration file will run the
|
||
# test suite on all supported python versions. To use it, "pip install tox"
|
||
# and then run "tox" from this directory.
|
||
[tox]
|
||
toxworkdir = /tmp/{env:USER}_nfvtox
|
||
envlist = pep8,py39,pylint
|
||
skipsdist = True
|
||
stxdir = {toxinidir}/../..
|
||
|
||
[testenv]
|
||
deps = -r{toxinidir}/requirements.txt
|
||
-r{toxinidir}/test-requirements.txt
|
||
install_command = pip install \
|
||
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
||
{opts} {packages}
|
||
allowlist_externals = cp
|
||
|
||
|
||
[nfv]
|
||
nfv_base_dir = .
|
||
nfv_client_dir = ./nfv-client
|
||
nfv_common_dir = ./nfv-common
|
||
nfv_plugins_dir = ./nfv-plugins
|
||
nfv_vim_dir = ./nfv-vim
|
||
nfv_test_dir = ./nfv-tests
|
||
stx_fault_dir = ../../fault
|
||
|
||
nfv_client_src_dir = {[nfv]nfv_client_dir}/nfv_client
|
||
nfv_common_src_dir = {[nfv]nfv_common_dir}/nfv_common
|
||
nfv_plugins_src_dir = {[nfv]nfv_plugins_dir}/nfv_plugins
|
||
nfv_vim_src_dir = {[nfv]nfv_vim_dir}/nfv_vim
|
||
nfv_test_src_dir = {[nfv]nfv_test_dir}
|
||
|
||
deps = {[nfv]nfv_client_dir}
|
||
{[nfv]nfv_common_dir}
|
||
{[nfv]nfv_plugins_dir}
|
||
{[nfv]nfv_vim_dir}
|
||
{[nfv]stx_fault_dir}/fm-api/source
|
||
iso8601
|
||
keyring
|
||
kombu
|
||
kubernetes
|
||
oslo.log
|
||
passlib
|
||
pecan
|
||
pyparsing
|
||
PyYAML
|
||
sqlalchemy
|
||
stevedore
|
||
wsme
|
||
|
||
[nosetests]
|
||
verbosity=2
|
||
|
||
[flake8]
|
||
# - hacking codes -
|
||
# H104: File contains nothing but comments
|
||
# 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
|
||
# warnings
|
||
# W503 line break before binary operator
|
||
# W504 line break after binary operator
|
||
# W605 invalid escape sequence
|
||
# errors
|
||
# E121 continuation line under-indented for hanging indent
|
||
# E122 continuation line missing indentation or outdented
|
||
# E124 closing bracket does not match visual indentation
|
||
# E126 continuation line over-indented for hanging indent
|
||
# E127 continuation line over-indented for visual indent
|
||
# E128 continuation line under-indented for visual indent
|
||
# E129 visually indented line with same indent as next logical line
|
||
ignore = H104,H404,H405,H501,
|
||
W503,W504,W605,
|
||
E121,E122,E124,E126,E127,E128,E129
|
||
# H106 Don’t put vim configuration in source files (off by default).
|
||
# H203 Use assertIs(Not)None to check for None (off by default).
|
||
# TODO: enable: H904 Delay string interpolations at logging calls (off by default).
|
||
enable-extensions = H106,H203
|
||
# rather than suppress E501 line too long, set max line length and reduce later
|
||
max-line-length = 185
|
||
|
||
[testenv:pep8]
|
||
usedevelop = False
|
||
skip_install = True
|
||
deps = -r{toxinidir}/test-requirements.txt
|
||
commands =
|
||
flake8 {[nfv]nfv_base_dir}
|
||
|
||
|
||
[testenv:pylint]
|
||
deps = {[nfv]deps}
|
||
-r{toxinidir}/test-requirements.txt
|
||
{[nfv]nfv_test_dir}/nfv_unit_tests
|
||
{[nfv]nfv_test_dir}/nfv_scenario_tests
|
||
jinja2
|
||
commands = pylint {[nfv]nfv_client_src_dir} \
|
||
{[nfv]nfv_common_src_dir} \
|
||
{[nfv]nfv_plugins_src_dir} \
|
||
{[nfv]nfv_vim_src_dir} \
|
||
{[nfv]nfv_test_src_dir}/nfv_unit_tests \
|
||
--rcfile=./pylint.rc
|
||
|
||
[bandit]
|
||
# These are the bandit codes that are failing for nfv
|
||
# B104: hardcoded_bind_all_interfaces
|
||
# B108: Probable insecure usage of temp file/directory
|
||
# B110: Try, Except, Pass detected.
|
||
# B310: Audit url open for permitted schemes
|
||
skips = B104,B108,B110,B310
|
||
exclude = ./nfv-docs,./nfv-tests,./nfv-debug-tools,unit_test
|
||
|
||
|
||
[testenv:bandit]
|
||
deps = -r{toxinidir}/test-requirements.txt
|
||
commands = bandit --ini tox.ini -f txt -r {[nfv]nfv_base_dir}
|
||
|
||
[testenv:py39]
|
||
deps = {[nfv]deps}
|
||
coverage
|
||
fixtures
|
||
stestr
|
||
testtools
|
||
setenv = PYTHONDONTWRITEBYTECODE=True
|
||
commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_stx_19.12 {envdir}/
|
||
stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}'
|
||
stestr slowest
|
||
|
||
|
||
[testenv:cover]
|
||
deps = {[nfv]deps}
|
||
coverage
|
||
fixtures
|
||
stestr
|
||
testtools
|
||
setenv =
|
||
PYTHON=coverage run --parallel-mode
|
||
PYTHONDONTWRITEBYTECODE=True
|
||
commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_stx_19.12 {envdir}/
|
||
coverage erase
|
||
stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}'
|
||
coverage combine
|
||
coverage html -d cover
|
||
coverage xml -o cover/coverage.xml
|
||
coverage report
|