[tox]

envlist = py{27,34,35,36,37,38,39-dev,py,py3},check,lint,docs,test_unit,coverage
skip_missing_interpreters = true

[flake8]

# See <https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes>
ignore = E128,E301,E302,E305,E402,W503,W504
max-line-length = 100
per-file-ignores =
    dropbox/stone_base.py: F401, F403
    dropbox/stone_validators.py: F401, F403
    dropbox/stone_serializers.py: F401, F403


[testenv:test_integration]

commands =
    pytest test/integration/

passenv =
    DROPBOX_REFRESH_TOKEN
    DROPBOX_APP_KEY
    DROPBOX_APP_SECRET
    DROPBOX_DOMAIN
    DROPBOX_TEAM_TOKEN
    DROPBOX_TOKEN
    DROPBOX_WEB_HOST
    DROPBOX_SHARED_LINK

deps =
    pip
    -rtest/requirements.txt

[testenv:check]

commands =
    python setup.py sdist bdist_wheel
    twine check dist/*

deps =
    twine

usedevelop = true


[testenv:lint]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
commands =
    flake8 setup.py dropbox example test
deps =
    flake8
    -rtest/requirements.txt

usedevelop = true

[testenv:coverage]

commands =
    coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
    coverage report

deps =
    -rtest/requirements.txt

[testenv:codecov]

commands =
    coverage run --rcfile=.coveragerc -m pytest test/unit/test_dropbox_unit.py
    coverage xml

deps =
    -rtest/requirements.txt

[testenv:test_unit]

commands =
    pytest test/unit/

deps =
    -rtest/requirements.txt

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
extras = docs
commands = sphinx-build -b html docs build/html
deps =
    sphinx