{% set with_coverage = True %}
{% include 'tox-envlist.j2' %}
{% include 'tox-testenv.j2' %}
{% include 'tox-lint.j2' %}
{% include 'tox-docs.j2' %}

[testenv:coverage]
basepython = %(coverage_basepython)s
allowlist_externals =
    mkdir
setenv =
{% if coverage_setenv %}
{% for line in coverage_setenv %}
    %(line)s
{% endfor %}
{% else %}
    COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
{% endif %}
deps =
    setuptools %(setuptools_version_spec)s
    coverage[toml]
{% for line in testenv_deps %}
    %(line)s
{% endfor %}
commands =
    mkdir -p {toxinidir}/parts/htmlcov
    coverage erase
{% if coverage_command %}
  {% for line in coverage_command %}
    %(line)s
  {% endfor %}
{% else %}
    coverage run -m zope.testrunner --test-path=src {posargs:-vc}
{% endif %}
{% if with_sphinx_doctests %}
    coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
{% endif %}
    coverage combine
    coverage html
    coverage report
{% for line in coverage_additional %}
%(line)s
{% endfor %}
