# # 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,py36,py39,pylint skipsdist = True stxdir = {toxinidir}/../.. [testenv] install_command = pip install \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ {opts} {packages} allowlist_externals = cp deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt [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 # flake8 # F841 local variable 'e' is assigned to but never used ignore = H104,H404,H405,H501, W503,W504,W605, E121,E122,E124,E126,E127,E128,E129, 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 # rather than suppress E501 line too long, set max line length and reduce later max-line-length = 185 [testenv:pep8] basepython = python3 usedevelop = False skip_install = True deps = -r{toxinidir}/test-requirements.txt commands = flake8 {[nfv]nfv_base_dir} [testenv:pylint] basepython = python3 deps = {[nfv]deps} -r{toxinidir}/test-requirements.txt {[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} \ --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} -r{toxinidir}/test-requirements.txt basepython = python3 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_stx_19.12 {envdir}/ stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}' stestr slowest [testenv:py36] basepython = python3.6 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_stx_19.12 {envdir}/ stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}' stestr slowest [testenv:py39] basepython = python3.9 install_command = pip install \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \ {opts} {packages} 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_stx_19.12 {envdir}/ stestr --test-path={[nfv]nfv_base_dir}/nfv-tests/nfv_unit_tests/tests run '{posargs}' stestr slowest [testenv:cover] basepython = python3 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_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