[testenv:bootstrap]
deps =
    jinja2
    matrix
    tox
skip_install = true
commands =
    python ci/bootstrap.py --no-env
passenv =
    *
; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist

[tox]
envlist =
    clean,
    check,
    docs,
    {py27,py36,py37,pypy,pypy3},
    report
ignore_basepython_conflict = true

[testenv]
basepython =
    pypy: {env:TOXPYTHON:pypy}
    pypy3: {env:TOXPYTHON:pypy3}
    py27: {env:TOXPYTHON:python2.7}
    {py36,docs}: {env:TOXPYTHON:python3.6}
    py37: {env:TOXPYTHON:python3.7}
    py38: {env:TOXPYTHON:python3.8}
    black: {env:TOXPYTHON:python3.7}
    {bootstrap,clean,check,report,codecov}: {env:TOXPYTHON:python2.7}
setenv =
    PYTHONUNBUFFERED=yes
passenv =
    *
usedevelop = false
deps =
    -r{toxinidir}/requirements.txt
    coverage
    docutils
    mock
    ways==0.1.0b1
commands =
    coverage run --parallel-mode -m unittest discover

[testenv:check]
deps =
    -r{toxinidir}/requirements.txt
    check-manifest
    isort
    pydocstyle
    pylint
    readme-renderer
skip_install = true
commands =
    python setup.py check --strict --metadata --restructuredtext
    check-manifest {toxinidir}
    pylint --disable=fixme,duplicate-code,bad-continuation src/code_include tests setup.py
    isort --verbose --check-only --diff --recursive src tests setup.py

[testenv:black]
deps =
    -r{toxinidir}/requirements.txt
    black
skip_install = true
commands =
    black --diff --check src setup.py tests

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

[testenv:codecov]
deps =
    codecov
    coverage
skip_install = true
commands =
    coverage xml --ignore-errors
    codecov []

[testenv:report]
deps = coverage
skip_install = true
commands =
    coverage combine --append
    coverage report --omit=tests/*
    coverage html --omit=tests/*

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