# --------------------------------------------------------------------
# TOX Setup
# --------------------------------------------------------------------

[tox]
envlist =
    cov_clean,
    py26,
    py27,
    py34,
    cov_combine,
    py3kwarn,
    pep8,
    docs

[testenv]
deps =
    coverage
    mock

commands =
    coverage run -a setup.py test
    coverage report
    /bin/sh -c "if [ ! -d .coverage.data ]; then /bin/mkdir .coverage.data; fi"
    /bin/mv {toxinidir}/.coverage {toxinidir}/.coverage.data/.coverage.{envname}

whitelist_externals =
    /bin/sh
    /bin/mv

# --------------------------------------------------------------------
# Python version specfic overrides
# --------------------------------------------------------------------


# --------------------------------------------------------------------
# Coverage
# --------------------------------------------------------------------
[testenv:cov_clean]
commands =
    coverage erase

[testenv:cov_combine]
commands =
    coverage combine .coverage.data
    coverage report

# --------------------------------------------------------------------
# Dist
# --------------------------------------------------------------------
[testenv:wheel]
skip_install = True
commands = python setup.py bdist_wheel

[testenv:sdist]
skip_install = True
commands = python setup.py sdist

# --------------------------------------------------------------------
# Lint
# --------------------------------------------------------------------
[testenv:py3kwarn]
deps =
    py3kwarn

commands =
    py3kwarn pyotrs

[testenv:pep8]
basepython =
    python3.4

deps =
    flake8
    flake8-quotes

commands =
    flake8 \
      --max-complexity=15 \
      --exclude=./build,.venv,.tox,dist,docs, \
      --ignore=Q000 \
      --max-line-length=99 \
      []

# --------------------------------------------------------------------
# Documentation
# --------------------------------------------------------------------
[testenv:docs]
basepython =
    python2.7

deps =
    sphinx
    sphinxcontrib-napoleon
    sphinx_rtd_theme

commands =
    # sphinx-build -b dirhtml {toxinidir}/docs/ {toxinidir}/build/docs/
    sphinx-build -b html {toxinidir}/docs/ {toxinidir}/build/docs/