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

[testenv]
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
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True
install_command =
  pip install -U {opts} {packages}
deps =
  -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/queens}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
whitelist_externals = sh
commands = stestr run {posargs}

[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}

[testenv:functional]
basepython = python2.7
setenv = OS_TEST_PATH=./gbpservice/tests/functional
         OS_SUDO_TESTING=1

[testenv:dsvm-functional]
basepython = python2.7
setenv = OS_TEST_PATH=./gbpservice/tests/functional
         OS_SUDO_TESTING=1
         OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
         OS_FAIL_ON_MISSING_DEPS=1
sitepackages=True

[tox:jenkins]
sitepackages = True

[testenv:pep8]
commands =
  flake8
  gbp-db-manage check_migration

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

[testenv:cover]
basepython = python2.7
commands =
  coverage erase
  coverage run -m testtools.run
  coverage report --include="*gbpservice*" --omit="*test*" --omit="*.tox*" --omit="*nfp*" -m

[testenv:venv]
commands = {posargs}

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

[flake8]
# E125 continuation line does not distinguish itself from next logical line - REVISIT
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line - REVISIT
# E402 module level import not at top of file - REVISIT
# E731 do not assign a lambda expression, use a def - REVISIT
# E741 ambiguous variable name - REVISIT
# F811 redefinition of unused variable - REVISIT
# F812 list comprehension redefines name from line - REVISIT
# H237 module is removed in Python 3 - REVISIT
# H401 docstring should not start with a space - REVISIT
# H404 multi line docstring should start with a summary - REVISIT
# H405 multi line docstring summary not separated with an empty line
# N530  direct neutron imports not allowed
# W504 line break after binary operator - REVISIT
# W605 invalid escape sequence - REVISIT
ignore = E125,E126,E128,E129,E402,E731,E741,F811,F812,H237,H401,H404,H405,N530,W504,W605
# H106: Don’t put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
# H204: Use assert(Not)Equal to check for equality
# H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls
enable-extensions = H106,H203,H204,H205,H904
show-source = true
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,
import-order-style = pep8

[hacking]
import_exceptions = neutron.openstack.common.gettextutils
local-check-factory = neutron_lib.hacking.checks.factory
