[tox]
envlist = py27,pep8
minversion = 1.8
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
usedevelop = True
install_command = pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/queens} {opts} {packages}
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
commands =
  dsvm-functional: {toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envbindir}
  stestr run {posargs}
  stestr slowest

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

[testenv:hashtest]
# This is the same as default environment, but with a random PYTHONHASHSEED.
# You can also specify a specific hashseed (for test repeatability) as follows:
#   tox --hashseed 1235130571 -e hashtest
setenv = VIRTUAL_ENV={envdir}

[tox:jenkins]
sitepackages = True

[testenv:pep8]
commands =
  # If it is easier to add a check via a shell script, consider adding it in this file
  flake8
whitelist_externals = sh

[testenv:cover]
setenv =
    {[testenv]setenv}
    PYTHON=coverage run --source openstack --parallel-mode
commands =
    stestr run {posargs}
    coverage combine
    coverage html -d cover
    coverage xml -o cover/coverage.xml

[testenv:venv]
commands = {posargs}

[testenv:docs]
commands = sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html

[flake8]
# N530  direct neutron imports not allowed
# N536  Use assertIsNone rather than assertEqual to check for None values
# N537  Log messages should not be translated!
ignore = N530,N536,N537
# H106: Don’t put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
# H904: Delay string interpolations at logging calls
enable-extensions=H106,H203,H904
show-source = true
builtins = _
exclude = ./.*,build,dist,networking_bigswitch/openstack/common/*

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

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