[tox]
envlist = py36, py37, py38, py39, pypy3, lint, docs, packaging

[gh-actions]
python =
    3.6: py36
    3.7: py37
    3.8: py38, lint, docs, packaging
    3.9: py39
    pypy3: pypy3

[testenv]
passenv =
    GITHUB_*
deps =
    pytest>=6.0.1,<7
    pytest-cov>=2.10.1,<3
    pytest-xdist>=2.2.1,<3
commands =
    pytest --cov-report=xml --cov-report=term --cov=hyperframe {posargs}

[testenv:pypy3]
# temporarily disable coverage testing on PyPy due to performance problems
commands = pytest {posargs}

[testenv:docs]
basepython = python3.8
deps =
    sphinx>=3.5.4,<4
whitelist_externals = make
changedir = {toxinidir}/docs
commands =
    make clean
    make html

[testenv:lint]
basepython = python3.8
deps =
    flake8==3.9.1
    mypy==0.812
commands =
    flake8 --max-complexity 10 src test
    mypy --strict src/

[testenv:packaging]
basepython = python3.8
deps =
    check-manifest==0.46
    readme-renderer==29.0
    twine==3.4.1
whitelist_externals = rm
commands =
    rm -rf dist/
    check-manifest
    python setup.py sdist bdist_wheel
    twine check dist/*
