[tox]
envlist = py36,py27,pep8
minversion = 3.1.1
skipsdist = True
# Automatic envs (pyXX) will use the python version appropriate to that
# env and ignore basepython inherited from [testenv]. That's what we
# want, and we don't need to be warned about it.
ignore_basepython_conflict = True

[testenv]
basepython = python3
setenv =
  VIRTUAL_ENV={envdir}
  LANGUAGE=en_US
  LC_ALL=en_US.utf-8
  OS_STDOUT_CAPTURE=1
  OS_STDERR_CAPTURE=1
  OS_TEST_TIMEOUT=60
usedevelop = True
install_command = pip install {opts} {packages}
deps =
  -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/stein}
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/test-requirements.txt
  -egit+https://git.openstack.org/openstack/neutron@stable/stein#egg=neutron
  -rhttps://git.openstack.org/cgit/openstack/neutron/plain/test-requirements.txt?h=stable/stein
whitelist_externals =
  bash
  find
commands =
  find . -type f -name "*.pyc" -delete

[testenv:py27]
commands =
  {[testenv]commands}
  stestr run {posargs}
  stestr slowest

[testenv:py35]
commands =
  {[testenv]commands}
  stestr run {posargs}
  stestr slowest

[testenv:py36]
commands =
  {[testenv]commands}
  stestr run {posargs}
  stestr slowest

[testenv:py37]
commands =
  {[testenv]commands}
  stestr run {posargs}
  stestr slowest

[testenv:pep8]
commands = flake8

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

[testenv:venv]
commands = {posargs}

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

[testenv:bashate]
commands =
  bash -c "ls devstack/*.sh | xargs bashate -v {posargs}"
whitelist_externals = bash

[flake8]
# N530 direct neutron imports not allowed
# W504 line break after binary operator
# It's either ^ or W503 (line break *before* binary operator). Match neutron.
ignore = N530,W504
enable-extensions = H106,H203,H204,H205,H904
show-source = true
exclude = ./.*,build,dist,doc
import-order-style = pep8

[hacking]
local-check-factory = networking_powervm.hacking.checks.factory

[testenv:lower-constraints]
deps =
  -c{toxinidir}/lower-constraints.txt
  -r{toxinidir}/test-requirements.txt
  -r{toxinidir}/requirements.txt
  -egit+https://git.openstack.org/openstack/neutron@stable/stein#egg=neutron
  -rhttps://git.openstack.org/cgit/openstack/neutron/plain/test-requirements.txt?h=stable/stein
