[tox]
project_name = openstep_plist
envlist = py{27,37}-cov,coverage
minversion = 3.4.0
isolated_build = true
skip_missing_interpreters = true

[testenv]
skip_install =
    cov: true
    nocov: false
deps =
    cython >= 0.28.5
    pytest
    pytest-randomly
    pytest-cython
    cov: coverage
changedir= {toxinidir}
setenv =
    cov: PYTHONPATH=src
    cov: CYTHON_ANNOTATE=1
    cov: CYTHON_TRACE=1
commands =
    cov: python setup.py build_ext -i
    nocov: pytest {posargs}
    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/master} {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]
addopts =
    -v
    -r a
