[tox]
minversion = 1.6
envlist = py35,py27,pep8
skipsdist = True

[testenv]
usedevelop = True
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/queens} {opts} {packages}
setenv =
   VIRTUAL_ENV={envdir}
   PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
                      rm
commands =
  {toxinidir}/tools/ostestr_compat_shim.sh {posargs}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY

[testenv:pep8]
basepython = python2.7
commands = flake8
           {toxinidir}/tools/coding-checks.sh --pylint '{posargs}'
           doc8 doc/source devstack releasenotes/source vagrant rally-jobs
           neutron-db-manage --subproject=networking-ovn check_migration

[testenv:venv]
commands = {posargs}

[testenv:functional]
setenv =
  {[testenv]setenv}
  OS_TEST_PATH=./networking_ovn/tests/functional
  OS_TEST_TIMEOUT=120
deps = {[testenv]deps}
       -r{toxinidir}/networking_ovn/tests/functional/requirements.txt

[testenv:functional-py35]
basepython = python3.5
setenv =
  {[testenv]setenv}
  OS_TEST_PATH=./networking_ovn/tests/functional
  OS_TEST_TIMEOUT=120
deps = {[testenv]deps}

[testenv:dsvm]
# Fake job to define environment variables shared between dsvm jobs
setenv = OS_TEST_TIMEOUT=120
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
commands = false

[testenv:dsvm-functional]
setenv = {[testenv:functional]setenv}
         {[testenv:dsvm]setenv}
deps = {[testenv:functional]deps}
commands =
  {toxinidir}/tools/ostestr_compat_shim.sh {posargs}

[testenv:dsvm-functional-py35]
basepython = python3.5
setenv = {[testenv:functional]setenv}
         {[testenv:dsvm]setenv}
deps = {[testenv:functional]deps}
commands =
  {toxinidir}/tools/ostestr_compat_shim.sh {posargs}

[testenv:cover]
commands =
  python setup.py test --coverage --coverage-package-name=networking_ovn --testr-args='{posargs}'
  coverage report

[testenv:docs]
basepython = python2.7
commands =
  rm -rf doc/build
  doc8 doc/source devstack releasenotes/source vagrant rally-jobs
  sphinx-build -W -b html doc/source doc/build/html

[testenv:debug]
commands = oslo_debug_helper -t networking_ovn/tests {posargs}

[testenv:genconfig]
commands =
    mkdir -p etc/neutron/plugins/ml2
    oslo-config-generator --config-file etc/oslo-config-generator/ml2_conf.ini
    oslo-config-generator --config-file etc/oslo-config-generator/networking_ovn_metadata_agent.ini
whitelist_externals = mkdir

[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[doc8]
# File extensions to check
extensions = .rst

[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# TODO(dougwig) -- uncomment this to test for remaining linkages
# N530 direct neutron imports not allowed

show-source = True
ignore = E123,E125,N530
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.tmp
import-order-style = pep8

[hacking]
import_exceptions = networking_ovn
local-check-factory = neutron_lib.hacking.checks.factory
