[tox]
minversion = 4.28.0
envlist = py3,pep8,docs

[testenv]
constraints =
  {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
deps =
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
commands =
  stestr run {posargs}

[testenv:pep8]
description =
  Run style checks.
deps =
  pre-commit
  {[testenv:mypy]deps}
commands =
  pre-commit run -a
  {[testenv:mypy]commands}

[testenv:mypy]
description =
  Run type checks.
deps =
  {[testenv]deps}
  mypy
  types-docutils
  types-PyYAML
commands =
  mypy --cache-dir="{envdir}/mypy_cache" {posargs:os_api_ref}

[testenv:venv]
commands = {posargs}

[testenv:cover]
setenv =
  {[testenv]setenv}
  PYTHON=coverage run --source nova --parallel-mode
commands =
  coverage erase
  stestr run {posargs}
  coverage combine
  coverage html -d cover
  coverage report

[testenv:docs]
deps =
  -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html

[testenv:debug]
commands = oslo_debug_helper {posargs}

[flake8]
# We only enable the hacking (H) checks
select = H
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build

[hacking]
import_exceptions =
  collections.abc
  typing
