; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist

[tox]
envlist =
    clean,
    check,
    {py37},
    report,
    docs

[testenv]
basepython =
    {docs,spell}: {env:TOXPYTHON:python3.7}
    py37: {env:TOXPYTHON:python3.7}
    {bootstrap,clean,check,report,extension-coveralls,coveralls,codecov}: {env:TOXPYTHON:python3}
setenv =
    PYTHONPATH={toxinidir}/tests
    PYTHONUNBUFFERED=yes
passenv =
    *
usedevelop = true
deps =
    -rrequirements.txt
    -rrequirements-dev.txt
commands =
    {posargs:pytest --cov --cov-report=term-missing -vv tests}

[testenv:bootstrap]
deps =
    jinja2
    matrix
skip_install = true
commands =
    python ci/bootstrap.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
whitelist_externals = make
commands =
    make -C docs clean
    make -C docs html

[testenv:check]
deps =
    docutils
    check-manifest
    flake8
    readme-renderer
    pygments
    isort
    twine
    pyopenssl
skip_install = true
commands =
    python setup.py sdist
    twine check dist/*
    check-manifest {toxinidir}
    flake8 thelper tests setup.py
    isort --check-only --diff --recursive thelper tests setup.py

[testenv:coveralls]
deps =
    coveralls
skip_install = true
commands =
    coveralls --merge=extension-coveralls.json []

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


[testenv:extension-coveralls]
deps =
    cpp-coveralls
skip_install = true
commands =
    coveralls --build-root=. --include=thelper --dump=extension-coveralls.json []

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

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

[flake8]
ignore = E225,E226,E227,E228,E231,E265,W504

[isort]
force_single_line=false
