[tox]
envlist = flake8,py{27,34,35,36,37},cov-report,cov-store

[testenv]
use_develop = true
deps =
    -r{toxinidir}/requirements-test.txt
    # setup.py has unpinned dependencies by default
    !unpinned: -r{toxinidir}/requirements.txt
setenv =
    COVERAGE_FILE = tests/.coverage.{envname}
    PYTHONDONTWRITEBYTECODE=1
commands =
    coverage run -m pytest {toxinidir}/tests {toxinidir}/flaskbb {posargs}

[testenv:flake8]
skip_install = true
deps = -r{toxinidir}/requirements-lint.txt
basepython=python3.6
commands =
    flake8 --version
    flake8 --config={toxinidir}/tox.ini {toxinidir}/flaskbb {toxinidir}/tests

[testenv:cov-report]
skip_install = true
setenv =
    COVERAGE_FILE = tests/.coverage
deps =
    -r{toxinidir}/requirements-cov.txt
commands =
    coverage combine tests
    coverage report

[testenv:cov-store]
skip_install = true
setenv =
    COVERAGE_FILE = tests/.coverage
deps =
    -r{toxinidir}/requirements-cov.txt
commands =
    coverage html


[testenv:black]
skip_install = true
deps = black
basepython=python3.6
commands = black --check tests/ flaskbb/

[flake8]
ignore = E203, E712, E711, W503
select = C,E,F,W,B,B9
max-complexity = 10
max-line-length = 88
exclude =
    # allowed to break the rules
    flaskbb/configs/default.py,
    flaskbb/_compat.py,
    # migrations are autogenerated
    migrations,
    # stuff to not inspect at all
    node_modules,
    .git,
    .tox,
    *.pyc,
    __pycache__,
    instance,
    dist,
    build,
    docs

[pytest]
addopts =  -vvl --strict --capture fd -W error::flaskbb.deprecation.FlaskBBDeprecation
norecursedirs = node_modules