[tox]
minversion = 2.0
envlist = pep8
skipsdist = True

[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
setenv =
   VIRTUAL_ENV={envdir}
   PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/test-requirements.txt
commands =
  stestr run {posargs}
  stestr slowest

[testenv:pep8]
basepython = python3
commands = flake8 {posargs}

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

[testenv:cover]
basepython = python3
setenv =
  {[testenv]setenv}
  PYTHON=coverage run --source octavia_tempest_plugin --parallel-mode
whitelist_externals =
  find
commands =
  find octavia_tempest_plugin -type f -name "*.pyc" -delete
  coverage erase
  stestr run {posargs}
  coverage combine
  coverage html -d cover
  coverage xml -o cover/coverage.xml

[testenv:docs]
basepython = python3
deps =
    -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/doc/requirements.txt
whitelist_externals = rm
commands =
  rm -rf doc/build
  sphinx-build -W -b html doc/source doc/build/html

[testenv:releasenotes]
basepython = python3
deps =
    -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/doc/requirements.txt
commands =
  sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}

[flake8]
# E123, E125 skipped as they are invalid PEP-8.

show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build

[testenv:genconfig]
basepython = python3
whitelist_externals = mkdir
commands =
         mkdir -p etc
         oslo-config-generator --output-file etc/octavia.tempest.conf.sample \
         --namespace tempest.config
