# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist =
    precommit
    safety
    mypy
    {py37,py38}-flake8
    {py35,py36,py37,pypy}-dj22
    {py36,py37,py38}-dj30
    {py36,py37,py38}-dj31
    {py35,py36,py37,pypy}-djmaster
    py38-dj31-postgres
    py38-dj31-mysql
    py38-djmaster-postgres

[testenv]
commands = make test
whitelist_externals = make
passenv =
    DJANGO_EXTENSIONS_DATABASE_ENGINE
    DJANGO_EXTENSIONS_DATABASE_NAME
    DJANGO_EXTENSIONS_DATABASE_USER

setenv =
    postgres: DJANGO_EXTENSIONS_DATABASE_ENGINE = {env:DJANGO_EXTENSIONS_DATABASE_ENGINE:django.db.backends.postgresql}
    postgres: DJANGO_EXTENSIONS_DATABASE_NAME = {env:DJANGO_EXTENSIONS_DATABASE_NAME:django_extensions_test}
    mysql: DJANGO_EXTENSIONS_DATABASE_ENGINE = {env:DJANGO_EXTENSIONS_DATABASE_ENGINE:django.db.backends.mysql}
    mysql: DJANGO_EXTENSIONS_DATABASE_NAME = {env:DJANGO_EXTENSIONS_DATABASE_NAME:django_extensions_test}

deps =
    -rrequirements-dev.txt
    dj22: Django==2.2
    dj30: Django>=3.0,<3.1
    dj31: Django>=3.1,<3.2
    djmaster: https://github.com/django/django/archive/master.tar.gz
    postgres: psycopg2-binary
    mysql: mysqlclient

[testenv:precommit]
deps =
    pre-commit
commands = pre-commit run -a

[testenv:safety]
deps =
    safety
commands = safety check --full-report

[testenv:mypy]
deps =
    mypy
commands = mypy --ignore-missing-imports django_extensions

[testenv:compile-catalog]
whitelist_externals =
    make
deps =
    Babel
commands =
    make compile-catalog

[testenv:py37-flake8]
deps =
    flake8
commands = flake8 django_extensions tests

[testenv:py38-flake8]
deps =
    flake8
commands = flake8 django_extensions tests
