[tox]
requires =
    tox>=4
; env_list = lint, type, 3.1{3,2}
env_list = lint, 3.1{3,2}
isolated_build = true
skip_missing_interpreters = true

[testenv]
description = run unit tests
deps =
    pytest>=8
    pytest-sugar
    pytest-cov
    pytest-mock
    pytest-xvfb
    -r requirements.txt
commands =
    {envpython} -m pytest {posargs}

[testenv:lint]
description = run linters
skip_install = true
deps = black==25.12.0
commands =
    {envpython} -c "import subprocess as s; import sys; "\
    "r = s.run(['black', '--check', '.'], capture_output=True, text=True, encoding='utf-8');"\
    "sys.stdout.write(r.stderr) if not r.returncode else sys.stderr.write(r.stderr)"

; [testenv:type]
; description = run type checks
; deps =
;     mypy
; commands =
;     mypy {posargs:src tests}

[testenv:signed_sdist]
description = create and sign the source tarball
skip_install = true
allowlist_externals =
    bash
    gpg
    rm
deps =
    build
commands =
    rm -f dist/*
    pyproject-build -s
    bash -c "gpg --detach-sign --armor dist/*.tar.gz"
