You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
166 lines
5.1 KiB
166 lines
5.1 KiB
# |
|
# 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://opendev.org/openstack/requirements/raw/upper-constraints.txt} {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 = ../../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 |
|
# 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 - |
|
# F823 local variable referenced before assignment |
|
# F841 local variable 'e' is assigned to but never used |
|
ignore = E121,E122,E123,E124,E126,E127,E128,E129,E501,H104,H404,H405,H501,F823,F841 |
|
# 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 |
|
usedevelop = False |
|
skip_install = True |
|
deps = -r{toxinidir}/test-requirements.txt |
|
commands = |
|
flake8 {[nfv]nfv_base_dir} |
|
|
|
|
|
[testenv:pylint] |
|
deps = {[nfv]deps} |
|
{[nfv]nfv_test_dir}/nfv_scenario_tests |
|
fixtures |
|
jinja2 |
|
mock |
|
testtools |
|
pylint |
|
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 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:py37] |
|
basepython = python3.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: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
|
|
|