[tox]
envlist =
    lint,
    py36,py37,py38
    docs,
    coverage
isolated_build = True

[testenv]
commands =
    pytest {posargs:}
extras =
    testing
setenv =
    COVERAGE_FILE=.coverage.{envname}

[testenv:coverage]
basepython = python3.8
commands =
    coverage combine
    coverage xml
    coverage report --show-missing
deps =
    coverage
setenv =
    COVERAGE_FILE=.coverage

[testenv:lint]
skip_install = True
basepython = python3.8
commands =
    black --check --diff .
    check-manifest
    # build sdist/wheel
    python -m pep517.build .
    twine check dist/*
deps =
    black
    readme_renderer
    check-manifest
    pep517
    twine

[testenv:docs]
whitelist_externals =
    make
commands =
    make -C docs-src html BUILDDIR={envdir} SPHINXOPTS="-E"
extras =
    docs

[testenv:run-flake8]
skip_install = True
basepython = python3.8
commands =
    flake8 src/glados/ tests
deps =
    flake8
    flake8-bugbear

[testenv:run-black]
skip_install = True
basepython = python3.8
commands =
    black .
deps =
    black

[testenv:build]
skip_install = true
basepython = python3.8
commands =
    # clean up build/ and dist/ folders
    python -c 'import shutil; shutil.rmtree("build", ignore_errors=True)'
    # Make sure we aren't forgetting anything
    check-manifest
    # build sdist/wheel
    python -m pep517.build .
    # Verify all is well
    twine check dist/*

deps =
    readme_renderer
    check-manifest
    pep517
    twine
