65a8eca8e1
A number of changes were done to the imports in the files. - Clean up flake8 H301 multiple imports per line - Remove noqa from top of files, allowing flake8 to run on all files. - Clean up relative imports in most places. This will simplify python3 support later. - Partially sort the imports. A later commit will enable that check since doing that here would have made the changeset even bigger. Story: 2003499 Task: 26561 Change-Id: Id5f95559f0d4604f4db1a1d74098063fd510142c Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
178 lines
5.4 KiB
INI
Executable File
178 lines
5.4 KiB
INI
Executable File
#
|
||
# Copyright (c) 2018 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,py27,pylint
|
||
skipsdist = True
|
||
stxdir = {toxinidir}/../..
|
||
|
||
[testenv]
|
||
recreate = True
|
||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/queens} {opts} {packages}
|
||
whitelist_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 = ../../stx-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
|
||
iso8601
|
||
keyring
|
||
kombu
|
||
kubernetes
|
||
passlib
|
||
pecan
|
||
pyparsing
|
||
PyYAML
|
||
sqlalchemy
|
||
stevedore
|
||
wsme
|
||
|
||
[nosetests]
|
||
verbosity=2
|
||
|
||
[flake8]
|
||
# Temporarily ignoring these warnings
|
||
# E121 continuation line under-indented for hanging indent
|
||
# E122 continuation line missing indentation or outdented
|
||
# E123 closing bracket does not match indentation of opening bracket
|
||
# 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
|
||
# E501 line too long
|
||
# - hacking codes -
|
||
# H104: File contains nothing but comments
|
||
# 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
|
||
# H501: Do not use self.__dict__ for string formatting
|
||
# - flake8 codes -
|
||
# F821 undefined name 'unicode' (python3 specific)
|
||
# - bugbear codes -
|
||
# B007 Loop control variable 'X' not used within the loop body. If this is intended, start the name with an underscore.
|
||
# B301 Python 3 does not include `.iter*` methods on dictionaries.
|
||
ignore = E121,E122,E123,E124,E126,E127,E128,E129,E501,
|
||
H104,H306,H401,H404,H405,H501,
|
||
F821,
|
||
B007, B301
|
||
# 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
|
||
max-line-length = 84
|
||
|
||
[testenv:pep8]
|
||
basepython = python3.5
|
||
usedevelop = False
|
||
skip_install = True
|
||
deps =
|
||
hacking
|
||
flake8-bugbear
|
||
flake8
|
||
commands =
|
||
flake8 {[nfv]nfv_base_dir}
|
||
|
||
|
||
[testenv:pylint]
|
||
deps = {[nfv]deps}
|
||
{[nfv]nfv_test_dir}/nfv_scenario_tests
|
||
fixtures
|
||
jinja2
|
||
mock
|
||
testtools
|
||
pylint
|
||
basepython = python2.7
|
||
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} \
|
||
--rcfile=./pylint.rc
|
||
|
||
[bandit]
|
||
# These are the bandit codes that are failing for stx-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
|
||
# B506: Test for use of yaml load
|
||
skips = B104,B108,B110,B310,B506
|
||
exclude = nfv-docs,nfv-tests,nfv-debug-tools,unit_test
|
||
|
||
[testenv:bandit]
|
||
deps = {[nfv]deps}
|
||
bandit
|
||
basepython = python2.7
|
||
commands = bandit --ini tox.ini -f txt -r {[nfv]nfv_base_dir}
|
||
|
||
[testenv:py27]
|
||
basepython = python2.7
|
||
deps = {[nfv]deps}
|
||
coverage
|
||
fixtures
|
||
mock
|
||
stestr
|
||
testtools
|
||
setenv = PYTHONDONTWRITEBYTECODE=True
|
||
commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_18.03_GA {envdir}/
|
||
stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}'
|
||
stestr slowest
|
||
|
||
[testenv:py35]
|
||
basepython = python3.5
|
||
deps = {[nfv]deps}
|
||
coverage
|
||
fixtures
|
||
mock
|
||
stestr
|
||
testtools
|
||
setenv = PYTHONDONTWRITEBYTECODE=True
|
||
commands = cp -v {[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/test_data/nfv_vim_db_18.03_GA {envdir}/
|
||
stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}'
|
||
stestr slowest
|
||
|
||
[testenv:cover]
|
||
basepython = python2.7
|
||
deps = {[nfv]deps}
|
||
coverage
|
||
fixtures
|
||
mock
|
||
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_18.03_GA {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
|