[tox]
envlist = clean, p311, report
isolated_build = true

[pytest]
minversion = 6.0
addopts = -ra -q
testpaths =
    tests

[testenv]
commands = pytest --cov {envsitepackagesdir}/scicom --cov-append --cov-report=term-missing
deps =
    -e ./[test]
depends =
    {py311}: clean
    report: py311

[testenv:report]
deps = coverage
skip_install = true
commands =
    coverage report
    coverage html -d tests/reports/html

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

[testenv:docs]
changedir = docs
deps =
    -e ./[docs]
description = Invoke sphinx-build to build the HTML docs
commands =
    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
    python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "html" / "index.html"))'
