[tox]
project_name = uharfbuzz
envlist = py3,py3-cov,coverage
skip_missing_interpreters = true

[testenv]
skip_install =
    cov: true
    !cov: false
deps =
    pytest
    cov: -rrequirements-dev.txt
changedir= {toxinidir}
setenv =
    cov: PYTHONPATH=src/uharfbuzz
    cov: CYTHON_ANNOTATE=1
    cov: CYTHON_LINETRACE=1
commands =
    !cov: pytest {posargs}
    cov: python setup.py develop
    cov: coverage run --parallel -m pytest {posargs}

[testenv:coverage]
skip_install = true
deps =
    cython
    coverage
    diff_cover
setenv =
    PYTHONPATH=src
passenv =
    DIFF_AGAINST
changedir = {toxinidir}
commands =
    coverage erase
    coverage combine
    coverage report
    coverage xml -o {toxworkdir}/coverage.xml
    coverage html
    diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml

[testenv:codecov]
skip_install = true
deps =
    {[testenv:coverage]deps}
    codecov
setenv = {[testenv:coverage]setenv}
passenv = TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
changedir = {toxinidir}
commands =
    coverage combine
    codecov --env TOXENV

[testenv:wheel]
description = build wheel package for upload to PyPI
skip_install = true
deps =
    setuptools >= 36.4.0
    pip >= 18.0
    wheel >= 0.31.0
changedir = {toxinidir}
commands =
    python -c 'import os, glob; whl = glob.glob(".tox/dist/*.whl"); whl and os.remove(whl[0])'
    pip wheel --pre --no-deps --no-cache-dir --wheel-dir {distdir} --find-links {distdir} --no-binary {[tox]project_name} {[tox]project_name}

[pytest]
testpaths = tests/
addopts =
    -v
    -r a
