[tox]
envlist = py35,py27,pep8
minversion = 1.6
skipsdist = True

[testenv]
usedevelop = True
whitelist_externals = bash
                      find
install_command = pip install {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
deps =
    -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky}
    -r{toxinidir}/requirements.txt
    -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}

[testenv:pep8]
basepython = python3
commands = flake8 {posargs}

[testenv:venv]
basepython = python3
commands = {posargs}

[testenv:functional]
setenv =
  OS_TEST_PATH = ./qinlingclient/tests/functional

[testenv:cover]
basepython = python3
setenv =
    PYTHON=coverage run --source qinlingclient --parallel-mode
commands =
    stestr run '{posargs}'
    coverage combine
    coverage html -d cover
    coverage xml -o cover/coverage.xml
    coverage report

[testenv:docs]
basepython = python3
whitelist_externals = rm
commands =
  rm -rf doc/build
  python setup.py build_sphinx

[testenv:debug]
basepython = python3
commands =
  find . -type f -name "*.pyc" -delete
  oslo_debug_helper -t qinlingclient/tests {posargs}

[testenv:pyflakes]
basepython = python3
deps =
 -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky}
 flake8
commands = flake8

[testenv:releasenotes]
basepython = python3
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html

[flake8]
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build,releasenotes

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