[tox]
minversion = 3.18.0
envlist = py3,pep8
ignore_basepython_conflict = True

[testenv]
basepython = python3
usedevelop = True
setenv =
  LANGUAGE=en_US
  LC_ALL=en_US.utf-8
  OS_STDOUT_CAPTURE=1
  OS_STDERR_CAPTURE=1
  OS_TEST_TIMEOUT=60
  PYTHONDONTWRITEBYTECODE=1
  PYTHONWARNINGS=default::DeprecationWarning
deps =
    -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
    -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}

[testenv:pep8]
commands = flake8 {posargs}

[testenv:venv]
commands = {posargs}

[testenv:cover]
allowlist_externals = find
setenv =
  PYTHON=coverage run --source zun-tempest-plugin --parallel-mode
commands =
  coverage erase
  find . -type f -name "*.pyc" -delete
  stestr run {posargs}
  coverage combine
  coverage html -d cover
  coverage xml -o cover/coverage.xml
  coverage report

[testenv:docs]
allowlist_externals = rm
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
       -r{toxinidir}/doc/requirements.txt
commands =
  rm -rf doc/build
  sphinx-build -W --keep-going -b html doc/source doc/build/html
  doc8 --ignore D000 -e .rst doc/source/ CONTRIBUTING.rst HACKING.rst README.rst

[testenv:releasenotes]
deps = {[testenv:docs]deps}
commands =
  sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html

[testenv:debug]
commands = oslo_debug_helper {posargs}

[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# W504 line break after binary operator

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