[tox]
minversion = 3.18.0
envlist = py39,pep8
ignore_basepython_conflict = true

[testenv]
basepython = python3
allowlist_externals =
  rm
deps =
  -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
  -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}

[testenv:pep8]
commands = flake8 {posargs}

[testenv:venv]
commands = {posargs}

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

[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_externals =
  make
commands =
  sphinx-build -W -b latex doc/source doc/build/pdf
  make -C doc/build/pdf

[testenv:releasenotes]
deps =
  {[testenv:docs]deps}
commands =
  rm -rf releasenotes/build
  sphinx-build -a -E -W -d releasenotes/build/doctrees -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 skipped since you must choose either W503 or W504 (they conflict)
show-source = True
ignore = E123,E125,H405,W504
builtins = _
exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build