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

[testenv]
setenv = VIRTUAL_ENV={envdir}
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}

deps = -r{toxinidir}/test-requirements.txt
       -r{toxinidir}/requirements.txt
       oslo.versionedobjects[fixtures]

#sitepackages=True

# By default ostestr will set concurrency
# to ncpu, to specify something else use
# the concurrency=<n> option.
# call ie: 'tox -epy27 -- --concurrency=4'
commands =
  find . -type f -name "*.pyc" -delete
  ostestr {posargs}

whitelist_externals =
  bash
  find
passenv = *_proxy *_PROXY

[testenv:pep8]
commands =
  flake8 {posargs} .
  {toxinidir}/tools/check_exec.py {toxinidir}/novajoin

[testenv:pylint]
deps = -r{toxinidir}/requirements.txt
       pylint==0.26.0
commands = bash tools/lintstack.sh

[testenv:bandit]
# Skip B104 hardcoded_bind_all_interfaces
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r novajoin -n5 -x tests -ll -s B104

[flake8]
# Following checks are ignored on purpose.
#
# E251 unexpected spaces around keyword / parameter equals
# reason: no improvement in readability
ignore = E251,D100,D101,D102,D202,D208
exclude = .git,.venv,.tox,dist,tools,doc,*egg,build
max-complexity=30

[testenv:venv]
# NOTE(jaegerandi): This target does not use constraints because
# upstream infra does not yet support it. Once that's fixed, we can
# drop the install_command.
install_command = pip install -U --force-reinstall {opts} {packages}
commands = {posargs}

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

[testenv:genconfig]
sitepackages = False
envdir = {toxworkdir}/pep8
commands = oslo-config-generator --config-file=files/novajoin-config-generator.conf

