[tox]
envlist =
    clean,
    check,
    docs,
    py27-cover,
    py27-nocov,
    py34-cover,
    py34-nocov,
    py35-cover,
    py35-nocov,
    py36-cover,
    py36-nocov,
    py37-cover,
    py37-nocov,
    pypy-cover,
    pypy-nocov,
    pypy3-cover,
    pypy3-nocov,
    report

[testenv]
basepython =
    {docs,spell}: {env:TOXPYTHON:python3.6}
    {bootstrap,clean,check,report,coveralls}: {env:TOXPYTHON:python3}
setenv =
    PYTHONPATH={toxinidir}/tests
    PYTHONUNBUFFERED=yes
passenv =
    *
deps =
    pytest
    pytest-travis-fold
commands =
    {posargs:pytest -vv --ignore=src}

[testenv:bootstrap]
deps =
    jinja2
    matrix
skip_install = true
commands =
    python ci/bootstrap.py

[testenv:check]
deps =
    docutils
    check-manifest
    flake8
    readme-renderer
    pygments
    isort
skip_install = true
commands =
    python setup.py check --strict --metadata --restructuredtext
    check-manifest {toxinidir}
    flake8 src tests setup.py
    isort --verbose --check-only --diff --recursive src tests setup.py


[testenv:spell]
setenv =
    SPELLCHECK=1
commands =
    sphinx-build -b spelling docs dist/docs
skip_install = true
deps =
    -r{toxinidir}/docs/requirements.txt
    sphinxcontrib-spelling
    pyenchant

[testenv:docs]
deps =
    -r{toxinidir}/docs/requirements.txt
commands =
    sphinx-build {posargs:-E} -b doctest docs dist/docs
    sphinx-build {posargs:-E} -b html docs dist/docs
    sphinx-build -b linkcheck docs dist/docs

[testenv:coveralls]
deps =
    coveralls
skip_install = true
commands =
    coveralls []



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

[testenv:clean]
commands = coverage erase
skip_install = true
deps = coverage

[testenv:py27-cover]
basepython = {env:TOXPYTHON:python2.7}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:py27-nocov]
basepython = {env:TOXPYTHON:python2.7}

[testenv:py34-cover]
basepython = {env:TOXPYTHON:python3.4}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:py34-nocov]
basepython = {env:TOXPYTHON:python3.4}

[testenv:py35-cover]
basepython = {env:TOXPYTHON:python3.5}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:py35-nocov]
basepython = {env:TOXPYTHON:python3.5}

[testenv:py36-cover]
basepython = {env:TOXPYTHON:python3.6}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:py36-nocov]
basepython = {env:TOXPYTHON:python3.6}

[testenv:py37-cover]
basepython = {env:TOXPYTHON:python3.7}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:py37-nocov]
basepython = {env:TOXPYTHON:python3.7}

[testenv:pypy-cover]
basepython = {env:TOXPYTHON:pypy}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:pypy-nocov]
basepython = {env:TOXPYTHON:pypy}

[testenv:pypy3-cover]
basepython = {env:TOXPYTHON:pypy3}
setenv =
    {[testenv]setenv}
usedevelop = true
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv}
deps =
    {[testenv]deps}
    pytest-cov

[testenv:pypy3-nocov]
basepython = {env:TOXPYTHON:pypy3}
