[tox]
envlist =
  py{37,39}-{pytest,lint,invalidcode,mypy}
  format
  format-check
  docs
skipdist = True

[testenv]
usedevelop = True
passenv = *
extras = tests
deps =
  py{37,39}-pytest: .[tests]
  py{37,39}-lint: flake8
  py{37,39}-invalidcode: flake8
  py{37,39}-mypy: mypy >= 0.761
commands =
  py{37,39}-pytest: pytest {posargs} -c pytest.ini
  py{37,39}-lint: flake8 moulinette test
  py{37,39}-invalidcode: flake8 moulinette test --select F
  py{37,39}-mypy: mypy  --ignore-missing-imports --install-types --non-interactive moulinette/

[gh-actions]
python =
  3.7: py37
  3.9: py39

[testenv:format]
basepython = python3
commands = black {posargs} moulinette test
deps = black
skip_install = True
usedevelop = False

[testenv:format-check]
basepython = {[testenv:format]basepython}
commands = black {posargs:--check --diff} moulinette test
deps = {[testenv:format]deps}
skip_install = {[testenv:format]skip_install}
usedevelop = {[testenv:format]usedevelop}

[testenv:docs]
basepython = {[testenv:format]basepython}
usedevelop = True
commands = python3 -m sphinx -W doc/ doc/_build
deps =
  -r{toxinidir}/doc/requirements.txt