[tox]
envlist = py{36,37}-cov,coverage
skip_missing_interpreters = true

[testenv]
deps =
    pytest
    -rrequirements.txt
    cov: coverage
commands =
    # run the test suite against the package installed inside tox env
    !cov: py.test {posargs}
    # if `*-cov` factor in the tox env name, also collect test coverage
    cov: coverage run --parallel-mode -m pytest {posargs}

[testenv:coverage]
deps =
    coverage
skip_install = true
commands=
    coverage combine
    coverage report
    coverage html

[testenv:coveralls]
description = upload coverage report to coveralls
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
    {[testenv:coverage]deps}
    coveralls
skip_install = true
ignore_outcome = true
download = true
commands=
    coverage combine
    coveralls
