# Tox (http://tox.testrun.org/) is a tool for running tests in
# multiple virtualenvs. To use it, "pip install tox" and then run
# "tox" from this directory.

[tox]
# acme and letsencrypt are not yet on pypi, so when Tox invokes
# "install *.zip", it will not find deps
skipsdist = true
envlist = py27,cover,lint

# nosetest -v => more verbose output, allows to detect busy waiting
# loops, especially on Travis

[testenv]
# packages installed separately to ensure that dowstream deps problems
# are detected, c.f. #1002
commands =
    pip install -e acme[testing]
    nosetests -v acme
    pip install -r requirements.txt -e .[testing]
    nosetests -v letsencrypt
    pip install -e letsencrypt-apache
    nosetests -v letsencrypt_apache
    pip install -e letsencrypt-nginx
    nosetests -v letsencrypt_nginx
    pip install -e letshelp-letsencrypt
    nosetests -v letshelp_letsencrypt

setenv =
    PYTHONPATH = {toxinidir}
    PYTHONHASHSEED = 0
# https://testrun.org/tox/latest/example/basic.html#special-handling-of-pythonhas

[testenv:py33]
commands =
    pip install -e acme[testing]
    nosetests -v acme

[testenv:py34]
commands =
    pip install -e acme[testing]
    nosetests -v acme

[testenv:cover]
basepython = python2.7
commands =
    pip install -r requirements.txt -e acme -e .[testing] -e letsencrypt-apache -e letsencrypt-nginx -e letshelp-letsencrypt
    ./tox.cover.sh

[testenv:lint]
basepython = python2.7
# separating into multiple invocations disables cross package
# duplicate code checking; if one of the commands fails, others will
# continue, but tox return code will reflect previous error
commands =
    pip install -r requirements.txt -e acme -e .[dev] -e letsencrypt-apache -e letsencrypt-nginx -e letsencrypt-compatibility-test -e letshelp-letsencrypt
    ./pep8.travis.sh
    pylint --rcfile=.pylintrc letsencrypt
    pylint --rcfile=.pylintrc acme/acme
    pylint --rcfile=.pylintrc letsencrypt-apache/letsencrypt_apache
    pylint --rcfile=.pylintrc letsencrypt-nginx/letsencrypt_nginx
    pylint --rcfile=.pylintrc letsencrypt-compatibility-test/letsencrypt_compatibility_test
    pylint --rcfile=.pylintrc letshelp-letsencrypt/letshelp_letsencrypt
