<commit_before>[tox]
envlist = docs,py38,pep8
minversion = 3.18.0
skipsdist = True
ignore_basepython_conflict = True

[testenv]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
         OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
         OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
         OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
         PYTHONWARNINGS=default::DeprecationWarning,ignore::DeprecationWarning:distutils,ignore::DeprecationWarning:site
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY TOX_ENV_SRC_MODULES
usedevelop = True
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
  hacking>=3.0.1,<3.1.0 # Apache-2.0
allowlist_externals = sh
commands =
  {toxinidir}/tools/pip_install_src_modules.sh "{toxinidir}"
  stestr run {posargs}

# there is also secret magic in ostestr which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.

[testenv:debug]
envdir = {toxworkdir}/shared
commands = oslo_debug_helper -t neutron/tests {posargs}

[testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
setenv = OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:180}
commands = false

[testenv:dsvm]
# Fake job to define environment variables shared between dsvm jobs
setenv = OS_SUDO_TESTING=1
         OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
         OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
         OS_FAIL_ON_MISSING_DEPS=1
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
commands = false

[testenv:functional]
setenv = {[testenv]setenv}
         {[testenv:common]setenv}
         OS_TEST_PATH=./neutron/tests/functional
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
# Because of issue with stestr and Python3, we need to avoid too much output
# to be produced during tests, so we will ignore python warnings here
         PYTHONWARNINGS=ignore
deps =
  {[testenv]deps}
  -r{toxinidir}/neutron/tests/functional/requirements.txt

[testenv:dsvm-functional]
setenv = {[testenv:functional]setenv}
         {[testenv:dsvm]setenv}
deps =
  {[testenv:functional]deps}
commands =
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --group-regex .*PostgreSQL\. --exclude-regex .*MySQL\. {posargs}
  stestr run --combine --concurrency 1 .*MySQL\. {posargs}

[testenv:dsvm-fullstack]
setenv = {[testenv]setenv}
         {[testenv:common]setenv}
         {[testenv:dsvm]setenv}
         # workaround for DB teardown lock contention (bug/1541742)
         OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:600}
         OS_TEST_PATH=./neutron/tests/fullstack
# Because of issue with stestr and Python3, we need to avoid too much output
# to be produced during tests, so we will ignore python warnings here
         PYTHONWARNINGS=ignore
deps =
  {[testenv:functional]deps}
commands =
  {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --concurrency 2 {posargs}

[testenv:dsvm-fullstack-gate]
setenv = {[testenv:dsvm-fullstack]setenv}
deps = {[testenv:dsvm-fullstack]deps}
commands =
  {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --concurrency 2 --black-regex neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}
  stestr run --combine --concurrency 1 neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}

[testenv:releasenotes]
envdir = {toxworkdir}/docs
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:pep8]
envdir = {toxworkdir}/lint
deps =
  {[testenv]deps}
  bashate>=0.5.1 # Apache-2.0
  bandit!=1.6.0,>=1.1.0 # Apache-2.0
  flake8-import-order==0.18.1 # LGPLv3
  pylint==2.5.3 # GPLv2
commands=
  # If it is easier to add a check via a shell script, consider adding it in this file
  sh ./tools/misc-sanity-checks.sh
  {toxinidir}/tools/check_unit_test_structure.sh
  # Checks for coding and style guidelines
  flake8
  sh ./tools/coding-checks.sh --pylint '{posargs}'
  neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration
  python ./tools/list_moved_globals.py
  {[testenv:genconfig]commands}
  {[testenv:bashate]commands}
  {[testenv:bandit]commands}
  {[testenv:genpolicy]commands}
allowlist_externals =
  sh
  bash

[testenv:cover]
envdir = {toxworkdir}/shared
setenv =
  {[testenv]setenv}
  PYTHON=coverage run --source neutron --parallel-mode
commands =
  stestr run --no-subunit-trace {posargs}
  coverage combine
  coverage report --fail-under=82 --skip-covered
  coverage html -d cover
  coverage xml -o cover/coverage.xml

[testenv:venv]
commands = {posargs}

[testenv:docs]
envdir = {toxworkdir}/docs
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/doc/requirements.txt
  -r{toxinidir}/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html

[testenv:pdf-docs]
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
allowlist_externals =
  make
commands =
  sphinx-build -W -b latex doc/source doc/build/pdf
  make -C doc/build/pdf

[testenv:linkcheck]
envdir = {toxworkdir}/docs
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck

[flake8]
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent<commit_msg>Docs build: Add NOTE to not remove requirements.txt<commit_after>[tox]
envlist = docs,py38,pep8
minversion = 3.18.0
skipsdist = True
ignore_basepython_conflict = True

[testenv]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
         OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
         OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
         OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
         PYTHONWARNINGS=default::DeprecationWarning,ignore::DeprecationWarning:distutils,ignore::DeprecationWarning:site
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY TOX_ENV_SRC_MODULES
usedevelop = True
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
  hacking>=3.0.1,<3.1.0 # Apache-2.0
allowlist_externals = sh
commands =
  {toxinidir}/tools/pip_install_src_modules.sh "{toxinidir}"
  stestr run {posargs}

# there is also secret magic in ostestr which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.

[testenv:debug]
envdir = {toxworkdir}/shared
commands = oslo_debug_helper -t neutron/tests {posargs}

[testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
setenv = OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:180}
commands = false

[testenv:dsvm]
# Fake job to define environment variables shared between dsvm jobs
setenv = OS_SUDO_TESTING=1
         OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
         OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
         OS_FAIL_ON_MISSING_DEPS=1
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
commands = false

[testenv:functional]
setenv = {[testenv]setenv}
         {[testenv:common]setenv}
         OS_TEST_PATH=./neutron/tests/functional
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
# Because of issue with stestr and Python3, we need to avoid too much output
# to be produced during tests, so we will ignore python warnings here
         PYTHONWARNINGS=ignore
deps =
  {[testenv]deps}
  -r{toxinidir}/neutron/tests/functional/requirements.txt

[testenv:dsvm-functional]
setenv = {[testenv:functional]setenv}
         {[testenv:dsvm]setenv}
deps =
  {[testenv:functional]deps}
commands =
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --group-regex .*PostgreSQL\. --exclude-regex .*MySQL\. {posargs}
  stestr run --combine --concurrency 1 .*MySQL\. {posargs}

[testenv:dsvm-fullstack]
setenv = {[testenv]setenv}
         {[testenv:common]setenv}
         {[testenv:dsvm]setenv}
         # workaround for DB teardown lock contention (bug/1541742)
         OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:600}
         OS_TEST_PATH=./neutron/tests/fullstack
# Because of issue with stestr and Python3, we need to avoid too much output
# to be produced during tests, so we will ignore python warnings here
         PYTHONWARNINGS=ignore
deps =
  {[testenv:functional]deps}
commands =
  {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --concurrency 2 {posargs}

[testenv:dsvm-fullstack-gate]
setenv = {[testenv:dsvm-fullstack]setenv}
deps = {[testenv:dsvm-fullstack]deps}
commands =
  {toxinidir}/tools/generate_dhclient_script_for_fullstack.sh {envdir}
  {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
  stestr run --concurrency 2 --black-regex neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}
  stestr run --combine --concurrency 1 neutron.tests.fullstack.test_securitygroup.TestSecurityGroupsSameNetwork.test_securitygroup {posargs}

[testenv:releasenotes]
envdir = {toxworkdir}/docs
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:pep8]
envdir = {toxworkdir}/lint
deps =
  {[testenv]deps}
  bashate>=0.5.1 # Apache-2.0
  bandit!=1.6.0,>=1.1.0 # Apache-2.0
  flake8-import-order==0.18.1 # LGPLv3
  pylint==2.5.3 # GPLv2
commands=
  # If it is easier to add a check via a shell script, consider adding it in this file
  sh ./tools/misc-sanity-checks.sh
  {toxinidir}/tools/check_unit_test_structure.sh
  # Checks for coding and style guidelines
  flake8
  sh ./tools/coding-checks.sh --pylint '{posargs}'
  neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration
  python ./tools/list_moved_globals.py
  {[testenv:genconfig]commands}
  {[testenv:bashate]commands}
  {[testenv:bandit]commands}
  {[testenv:genpolicy]commands}
allowlist_externals =
  sh
  bash

[testenv:cover]
envdir = {toxworkdir}/shared
setenv =
  {[testenv]setenv}
  PYTHON=coverage run --source neutron --parallel-mode
commands =
  stestr run --no-subunit-trace {posargs}
  coverage combine
  coverage report --fail-under=82 --skip-covered
  coverage html -d cover
  coverage xml -o cover/coverage.xml

[testenv:venv]
commands = {posargs}

[testenv:docs]
envdir = {toxworkdir}/docs
# Do not remove requirements.txt from deps list as without it
# upper constraints will not be used for deps listed in requirements.txt
# and may cause issues
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
  -r{toxinidir}/doc/requirements.txt
  -r{toxinidir}/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html

[testenv:pdf-docs]
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
allowlist_externals =
  make
commands =
  sphinx-build -W -b latex doc/source doc/build/pdf
  make -C doc/build/pdf

[testenv:linkcheck]
envdir = {toxworkdir}/docs
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck

[flake8]
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
{'fraction_non_alphanumeric': 0.11175095977299282, 'fraction_numerical': 0.01185110999833083, 'mean_word_length': 4.644371172868582, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5050802', 'n_tokens_mistral': 4519, 'n_tokens_neox': 4320, 'n_words': 873}