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

[testenv]

# Note the hash seed is set to 0 until senlin can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir}
         PYTHONHASHSEED=0

deps = -r{toxinidir}/test-requirements.txt

usedevelop = True
install_command = pip install {opts} {packages}
commands =
    ostestr --slowest --regex '^((?!tests\.functional).)+$' {posargs}

whitelist_externals = bash

[testenv:functional]
passenv = OS_USERNAME OS_PASSWORD OS_TENANT_NAME OS_USER_DOMAIN_NAME OS_PROJECT_DOMAIN_NAME OS_REGION_NAME OS_AUTH_URL
commands =
    ostestr --slowest --concurrency 1 --regex '^(.*?tests\.functional)' {posargs}

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

[testenv:venv]
commands = {posargs}

[testenv:cover]
setenv = VIRTUAL_ENV={envdir}
commands = python setup.py testr --coverage --testr-args="^(?!senlin\.tests\.functional){posargs}"

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

[flake8]
ignore = 
show-source = true
exclude=.venv,.git,.tox,cover,dist,*lib/python*,*egg,tools,build
max-complexity=20

[hacking]
import_exceptions = senlin.common.i18n
