[tox]
minversion = 3.9.0
envlist = py3,pep8
skipsdist = True
ignore_basepython_conflict=true

[testenv]
basepython = python3
usedevelop = True
setenv =
   VIRTUAL_ENV={envdir}
   PYTHONDONTWRITEBYTECODE = 1
   LANGUAGE=en_US
   LC_ALL=en_US.UTF-8
   PYTHONWARNINGS=default::DeprecationWarning
deps  =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt
commands = stestr run {posargs}

[testenv:pep8]
deps =
    hacking>=3.1.0,<4.0.0 # Apache-2.0
    doc8>=0.8.1 # Apache-2.0
    flake8-import-order>=0.17.1 # LGPLv3
    pycodestyle>=2.0.0,<2.7.0 # MIT
commands =
    flake8 {posargs}
    doc8 README.rst CONTRIBUTING.md doc/source

[testenv:cover]
setenv =
    PYTHON=coverage run --parallel-mode
commands =
  coverage erase
  stestr run {posargs}
  coverage combine
  coverage report
  coverage html
  coverage xml -o cover/coverage.xml

[testenv:releasenotes]
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
  -r{toxinidir}/doc/requirements.txt
commands =
  sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[testenv:docs]
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html

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

[testenv:venv]
setenv = PYTHONHASHSEED=0
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/wallaby}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/doc/requirements.txt
commands = {posargs}

[flake8]
application-import-names = ironic_prometheus_exporter
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
show-source = True


[testenv:lower-constraints]
deps =
  -c{toxinidir}/lower-constraints.txt
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt
