[tox]
minversion = 2.3.1
envlist = py27,py37,pep8
skipsdist = True

[testenv]
# Note the hash seed is set to 0 until neutron can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
         PYTHONHASHSEED=0
         PYTHONWARNINGS=default::DeprecationWarning
usedevelop = True
install_command =
    pip install -U -c{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 = sh
                      find
commands = find . -type f -name "*.py[c|o]" -delete
           stestr run {posargs}

[testenv:fullstack]
basepython = python2.7
setenv = OS_TEST_PATH=./kuryr_libnetwork/tests/fullstack
passenv = OS_*

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

[testenv:debug-py27]
basepython = python2.7
commands = oslo_debug_helper -t kuryr_libnetwork/tests {posargs}

[testenv:debug-py35]
basepython = python3.5
commands = oslo_debug_helper -t kuryr_libnetwork/tests {posargs}

[testenv:pep8]
basepython = python3
commands = flake8

[testenv:venv]
basepython = python3
commands = {posargs}

[testenv:cover]
basepython = python3
setenv =
    VIRTUAL_ENV={envdir}
    PYTHON=coverage run --source kuryr_libnetwork --parallel-mode
commands =
    stestr run {posargs}
    coverage combine
    coverage html -d cover
    coverage xml -o cover/coverage.xml
    coverage report

[testenv:docs]
basepython = python3
commands = python setup.py build_sphinx

[flake8]
# E128 continuation line under-indented for visual indent
ignore = E128
show-source = true

exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,releasenotes

[testenv:pylint]
basepython = python3
deps =
  {[testenv]deps}
  pylint
commands =
  pylint --rcfile=.pylintrc --output-format=colorized {posargs:neutron}

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

[testenv:genconfig]
basepython = python3
commands = {toxinidir}/tools/generate_config_file_samples.sh

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

[testenv:lower-constraints]
basepython = python3
deps =
  -c{toxinidir}/lower-constraints.txt
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt
