[tox]
envlist=bluecheck,doc8,docs,isortcheck,flake8,mypy,pylint,rstcheck,py38,py39,py310,py311
skip_missing_interpreters=True

[testenv]
commands=pytest
deps=
    django==4.2.*
    pytest
    pytest-cov
    pytest-django
    pytest-xdist
setenv=
    DJANGO_SETTINGS_MODULE=tests.settings
    PYTHONPATH={toxinidir}

[testenv:blue]
commands=blue {toxinidir}/setup.py {toxinidir}/diskcache {toxinidir}/tests
deps=blue

[testenv:bluecheck]
commands=blue --check {toxinidir}/setup.py {toxinidir}/diskcache {toxinidir}/tests
deps=blue

[testenv:doc8]
commands=doc8 docs --ignore-path docs/_build
deps=doc8

[testenv:docs]
allowlist_externals=make
changedir=docs
commands=make html
deps=
    django==4.2.*
    sphinx

[testenv:flake8]
commands=flake8 {toxinidir}/setup.py {toxinidir}/diskcache {toxinidir}/tests
deps=flake8

[testenv:isort]
commands=isort {toxinidir}/setup.py {toxinidir}/diskcache {toxinidir}/tests
deps=isort

[testenv:isortcheck]
commands=isort --check {toxinidir}/setup.py {toxinidir}/diskcache {toxinidir}/tests
deps=isort

[testenv:mypy]
commands=mypy {toxinidir}/diskcache
deps=mypy

[testenv:pylint]
commands=pylint {toxinidir}/diskcache
deps=
    django==4.2.*
    pylint

[testenv:rstcheck]
commands=rstcheck {toxinidir}/README.rst
deps=rstcheck

[testenv:uploaddocs]
allowlist_externals=rsync
changedir=docs
commands=
    rsync  --rsync-path 'sudo -u herokuish rsync' -azP --stats --delete \
        _build/html/ \
        grantjenks:/srv/www/grantjenks.com/public/docs/diskcache/

[isort]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 79

[pytest]
addopts=
    -n auto
    --cov-branch
    --cov-fail-under=98
    --cov-report=term-missing
    --cov=diskcache
    --doctest-glob="*.rst"
    --ignore docs/case-study-web-crawler.rst
    --ignore docs/sf-python-2017-meetup-talk.rst
    --ignore tests/benchmark_core.py
    --ignore tests/benchmark_djangocache.py
    --ignore tests/benchmark_glob.py
    --ignore tests/issue_85.py
    --ignore tests/plot.py

[doc8]
# ignore=D000

[flake8]
exclude=tests/test_djangocache.py
extend-ignore=E203
max-line-length=120
