# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py{27,36,37}-cov, py{py}-nocov, htmlcov

[testenv]
deps =
    cov: coverage>=4.3
    pytest
    fontparts>=0.8.1
    FontTools[ufo,lxml,unicode]>=3.32.0
install_command =
    pip install -v {opts} {packages}
commands =
    cov: coverage run --parallel-mode -m pytest {posargs}
    nocov: pytest {posargs}

[testenv:htmlcov]
basepython = {env:TOXPYTHON:python3.6}
deps =
    coverage>=4.3
skip_install = true
commands =
    coverage combine
    coverage html

[testenv:codecov]
passenv = *
basepython = {env:TOXPYTHON:python}
deps =
    coverage>=4.3
    codecov
skip_install = true
ignore_outcome = true
commands =
    coverage combine
    codecov --env TOXENV

[testenv:bdist]
basepython = {env:TOXPYTHON:python3.6}
deps =
    pygments
    docutils
    setuptools
    wheel
skip_install = true
install_command =
    # make sure we use the latest setuptools and wheel
    pip install --upgrade {opts} {packages}
whitelist_externals =
    rm
commands =
    # check metadata and rst long_description
    python setup.py check --restructuredtext --strict
    # clean up build/ and dist/ folders
    rm -rf {toxinidir}/dist
    python setup.py clean --all
    # build sdist
    python setup.py sdist --dist-dir {toxinidir}/dist
    # build wheel from sdist
    pip wheel -v --no-deps --no-index --wheel-dir {toxinidir}/dist --find-links {toxinidir}/dist fontPens
