# 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.
[pytest]
DJANGO_SETTINGS_MODULES=tests.settings
django_find_project = false
python_paths = django_comments_tree
python_files = test_*.py

[tox]
skipsdist = True
envlist = py{37,38}-django{210,220}

[travis]
python =
  3.7: py37
  3.8: py38

[travis:env]
DJANGO =
  2.1: django210
  2.2: django220

[testenv]
changedir = {toxinidir}/django_comments_tree
commands = pytest {posargs} # -rw --cov-config .coveragerc --cov django_comments_tree
deps =
    #-rrequirements.pip
    pip
    six
    docutils
    Markdown
    django-markup
    markdown
    django-markdown2
    draftjs-exporter
    pytest
    pytest-cov
    pytest-django
    selenium
    factory_boy
    django-treebeard
    djangorestframework
    django-markupfield
    py37-django210: django>=2.1,<2.2
    py37-django220: django>=2.2,<2.3
    py38-django210: django>=2.1,<2.2
    py38-django220: django>=2.2,<2.3
setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}
    DJANGO_SETTINGS_MODULE=django_comments_tree.tests.settings

[flake8]
ignore = D203,C901,W503
exclude = .git,.venv3,__pycache__,docs/source/conf.py,old,build,dist,.tox,docs,django_comments_tree/tests,django_comments_tree/migrations
max-complexity = 10
max-line-length = 100

[testenv:pep8]
show-source = True
commands = {envbindir}/flake8 --ignore C901 --max-line-length=100 --exclude=.tox,docs,django_comments_tree/tests,django_comments_tree/migrations django_comments_tree
# Flake8 only needed when linting.
# Do not care about other dependencies, it's just for linting.
deps = flake8
changedir = {toxinidir}

[testenv:js]
commands =
    npm install --prefix {toxinidir}
