[tox]
minversion = 3.23.0
requires =
    virtualenv >= 20.4.3
    tox < 4.0.0
    tox-wheel >= 0.6.0
isolated_build = true
envlist =
    flake8,
    tests,
    apidocs


[testenv]
wheel = true
wheel_build_env = build
skip_install =
    pindeps: true
deps =
    tests: -rrequirements_tests.txt
    mypy: -rrequirements_mypy.txt
    apidocs: pydoctor
    lint: pre-commit
    pindeps: pip-tools
extras =
    mypy: scripts
    tests: scripts

setenv =
    ; Suppress pointless chatter in the output.
    PIP_DISABLE_PIP_VERSION_CHECK=yes

    tests: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
    ; This must be an absolute path because the example tests
    ; run Python processes with alternative working directories.
    tests: COVERAGE_FILE={toxinidir}/.coverage

commands =
    python -V

    lint: pre-commit run --all-files --show-diff-on-failure

    apidocs: pydoctor -q --project-name incremental src/incremental

    tests: coverage --version
    tests: {envbindir}/trial --version
    tests: coverage erase
    tests: coverage run {envbindir}/trial incremental
    tests: coverage run {envbindir}/trial tests/test_examples.py
    tests: coverage combine
    tests: coverage report
    tests: coverage html
    tests: coverage xml

    mypy: mypy src

    pindeps: pip-compile -o requirements_tests.txt requirements_tests.in {posargs}
    pindeps: pip-compile -o requirements_mypy.txt requirements_mypy.in {posargs}


[testenv:build]
# empty environment to build universal wheel once per tox invocation
# https://github.com/ionelmc/tox-wheel#build-configuration
