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

[testenv]
setenv = VIRTUAL_ENV={envdir}
         PYTHONWARNINGS=default::DeprecationWarning
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
          OS_FAIL_ON_MISSING_DEPS
usedevelop = True
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
commands = {toxinidir}/tools/ostestr_compat_shim.sh {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:dsvm]
# Fake job to define environment variables shared between dsvm jobs
setenv = OS_SUDO_TESTING=1
         OS_FAIL_ON_MISSING_DEPS=1
         OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
commands = false

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

[testenv:dsvm-functional]
basepython = python2.7
setenv = {[testenv:functional]setenv}
         {[testenv:dsvm]setenv}
sitepackages=True
deps =
    {[testenv:functional]deps}

[testenv:fullstack]
setenv = {[testenv]setenv}
         OS_TEST_PATH=./networking_odl/tests/fullstack
commands = bash {toxinidir}/networking_odl/tests/fullstack/pre_test.sh
           bash tools/pretty_tox.sh '{posargs}'

[testenv:dsvm-fullstack]
setenv = {[testenv:fullstack]setenv}
         {[testenv:dsvm]setenv}
sitepackages=True
commands = bash {toxinidir}/networking_odl/tests/fullstack/pre_test.sh
           bash tools/pretty_tox.sh '{posargs}'

[testenv:pep8]
commands =
  flake8
  doc8 doc/source devstack releasenotes/source rally-jobs
  neutron-db-manage --subproject networking-odl check_migration

[testenv:i18n]
commands = python ./tools/check_i18n.py ./networking_odl ./tools/i18n_cfg.py

[testenv:venv]
# NOTE(yamahata): translation job can't use zuul-cloner or upper-constraints
install_command = pip install -U {opts} {packages}
commands = {posargs}

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

[testenv:docs]
commands =
  doc8 doc/source devstack releasenotes/source rally-jobs
  python setup.py build_sphinx

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

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

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

[flake8]
# H803 skipped on purpose per list discussion.
# TODO(dougwig) -- uncomment this to test for remaining linkages
# N530 direct neutron imports not allowed
show-source = True
ignore = H803,N530
exclude=./.*,dist,doc,releasenotes,*lib/python*,*egg,build,tools

[testenv:genconfig]
deps = -r{toxinidir}/requirements.txt
commands =
    mkdir -p etc/neutron/plugins/ml2
    oslo-config-generator --namespace ml2_odl --output-file etc/neutron/plugins/ml2/ml2_conf_odl.ini.sample
whitelist_externals = mkdir

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