[tox]
minversion = 2.7
envlist =
    lint,
    py36-dj{30,31},
    py37-dj{30,31,32},
    py38-dj{30,31,32,master},
    py39-dj{30,31,32,master},
    pypy3-dj{30,31,32}


[travis:env]
DJANGO =
    2.1: dj21
    2.2: dj22
    3.0: dj30
    3.1: dj31
    3.2: dj32
    master: djmaster


[testenv]
whitelist_externals = env
# This is required for gdal to install
setenv =
    CPLUS_INCLUDE_PATH=/usr/include/gdal
    C_INCLUDE_PATH=/usr/include/gdal
deps =
    dj21: Django>=2.1,<2.2
    dj22: Django>=2.2,<2.3
    dj30: Django>=3.0a1,<3.1
    dj31: Django>=3.1,<3.2
    dj32: Django>=3.2,<3.3
    djmaster: git+https://github.com/django/django
    mysqlclient
    py{35,36,37,38,39}: psycopg2
    ; gdal=={env:GDAL_VERSION:2.4}
    pypy3: psycopg2cffi>=2.7.6
    before_after==1.0.0
    jinja2>=2.10
    dill
commands =
    ./run_tests.py []
    env CACHEOPS_PREFIX=1 ./run_tests.py []
    env CACHEOPS_LRU=1 ./run_tests.py []
    env CACHEOPS_DB=mysql ./run_tests.py []
    env CACHEOPS_DB=postgresql ./run_tests.py []
    ; env CACHEOPS_DB=postgis ./run_tests.py []
    ; Test invalidate command
    ./manage.py invalidate tests.post
    ./manage.py invalidate tests
    ./manage.py invalidate all


[flake8]
max-line-length = 100
ignore = E126,E127,E131,E226,E261,E265,E266,E302,E305,E401,E402,F403,F405,E731,W503
exclude = cross.py,.tox/*

[testenv:lint]
deps = flake8
commands = flake8
