[base]
deps =
    mock
    nose
build_docs =
    make -C doc clean
    make -C doc html SPHINXOPTS="-v"

[tox]
minversion = 3.1
ignore_basepython_conflict = true
envlist =
    lint
    py{27,36}

[testenv]
basepython = python3.6
deps =
    py{27,36}: {[base]deps}
setenv =
    LC_ALL=en_US.utf-8
    LANG=en_US.utf-8
commands =
    nosetests tests
    {[base]build_docs}
    git --no-pager diff --no-index -- tests/data/regression_{envname}.html doc/build/html/regression.html
whitelist_externals =
    git
    make

[testenv:lint]
deps =
    pycodestyle
    pydocstyle
    pylint
    black
commands =
    pycodestyle sphinx_bluebrain_theme
    pydocstyle sphinx_bluebrain_theme
    pylint --rcfile=setup.cfg sphinx_bluebrain_theme
    pycodestyle mkdocs2sphinx
    pydocstyle mkdocs2sphinx
    pylint --rcfile=setup.cfg mkdocs2sphinx
    pycodestyle translate_templates.py
    pydocstyle translate_templates.py
    pylint --rcfile=setup.cfg translate_templates.py
    pycodestyle setup.py
    pydocstyle setup.py
    pylint --rcfile=setup.cfg setup.py
    pycodestyle tests
    pydocstyle tests
    pylint --rcfile=setup.cfg tests
    pylint --rcfile=setup.cfg doc/source/conf.py
    black . --check -v

[testenv:coverage]
deps =
    {[base]deps}
    coverage
commands =
    coverage run --source sphinx_bluebrain_theme,mkdocs2sphinx {envbindir}/nosetests tests
    coverage report --show-missing
    coverage xml
    coverage html

[testenv:docs]
commands =
    {[base]build_docs}

[testenv:black]
deps = black
commands = black . -v
