[tox]
minversion = 2.0
envlist =py36,py38, pep8,pylint,docs
skipsdist = True

[testenv]
basepython = python3
usedevelop = True
deps =
  -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/yoga}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
passenv =
    http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
setenv =
    VIRTUAL_ENV={envdir}
    OS_TEST_PATH = ./tests/unit
commands =
    find . -type f -name "*.pyc" -delete
    stestr run {posargs}
    rm -f .coverage
    rm -rf .testrepository

whitelist_externals =
    find
    coverage
    rm
python_files = test_*.py
norecursedirs  = .tox .venv

[testenv:venv]
commands = {posargs}

[testenv:docs]
commands =
  sphinx-build -W -b html doc/source doc/build/html

[testenv:py36]
basepython = python3.6

[testenv:py38]
basepython = python3.8

[testenv:pep8]
commands = flake8 freezer_dr

[testenv:pylint]
commands = pylint --rcfile .pylintrc freezer_dr

[testenv:genconfig]
sitepackages = False
envdir = {toxworkdir}/venv
commands =
  oslo-config-generator --config-file=config-generator/freezer-dr.conf

[flake8]
# it's not a bug that we aren't using all of hacking
# H102 -> apache2 license exists
# H103 -> license is apache
# H201 -> no bare excepts
# H501 -> don't use locals() for str formatting
# H903 -> \n not \r\n
ignore = H
select = H102, H103, H201, H501, H903, H201, H306, H301, H233
show-source = True
exclude = .venv,.tox,dist,doc,test,*egg,tests

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