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

[testenv]
# Note the hash seed is set to 0 until heat can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
         OS_TEST_DBAPI_ADMIN_CONNECTION=mysql+pymysql://openstack_citest:openstack_citest@localhost/;postgresql://openstack_citest:openstack_citest@localhost/postgres;sqlite://
         PYTHONHASHSEED=0
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
commands =
  find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.pyc' -delete
  python setup.py testr --slowest --testr-args='^(?!heat_integrationtests){posargs}'

whitelist_externals =
  bash
  find

[testenv:py27log]
commands =
  find . -type f -name "*.pyc" -delete
  bash tools/pretty_tox.sh '^(?!heat_integrationtests){posargs}'

[testenv:integration]
setenv = VIRTUAL_ENV={envdir}
         TESTR_START_DIR=heat_integrationtests
passenv = OS_*
usedevelop = False
deps = -r{toxinidir}/heat_integrationtests/requirements.txt
commands =
  bash tools/pretty_tox.sh '^heat_integrationtests.*{posargs}'

[testenv:pep8]
commands =
    flake8 heat bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-engine bin/heat-manage contrib heat_integrationtests
    # Check that .po and .pot files are valid:
    bash -c "find heat -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"

[testenv:venv]
commands = {posargs}

[testenv:cover]
commands =
  python setup.py testr --coverage --testr-args='^(?!heat_integrationtests){posargs}'

[testenv:docs]
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
       sphinxcontrib-httpdomain
commands = python setup.py build_sphinx

[testenv:genconfig]
commands =
    oslo-config-generator --config-file=config-generator.conf
    oslo-config-generator --config-file=heat_integrationtests/config-generator.conf

# FIXME(sirushtim): Sneak in flake8 here for now. This env will also be used
#                   to run the tests in the near future.
[testenv:py34]
deps = -r{toxinidir}/requirements-py3.txt
       -r{toxinidir}/test-requirements-py3.txt
commands =
  flake8 heat bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-engine bin/heat-manage contrib heat_integrationtests
  find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.pyc' -delete
  python setup.py testr --slowest --testr-args='--load-list py3-testlist'


[flake8]
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line
ignore = H404,H405
show-source = true
exclude=.*,dist,*openstack/common*,*lib/python*,*egg,tools,build
max-complexity=20

[hacking]
import_exceptions = heat.common.i18n
