[tox]
envlist = py310

[flake8]
; Allow >> on newline (W503), and allow cls as first argument for pydantic validators (B902)
ignore = B902,W503
exclude = .git,.*_cache,.eggs,*.egg-info,__pycache__,venv,.tox,gso/migrations,docs
enable-extensions = G
select = B,C,D,E,F,G,I,N,S,T,W,B902,B903,R
max-line-length = 120
ban-relative-imports = true

[pytest]
markers = workflow

[testenv]
passenv = DATABASE_URI_TEST,SKIP_ALL_TESTS,ENVIRONMENT_IGNORE_MUTATION_DISABLED
setenv =
    OAUTH2_ACTIVE = False
deps =
    coverage
    flake8
    black
    mypy
    ruff
    isort
    types-requests
    celery-stubs
    -r requirements.txt

commands =
    isort -c .
    ruff .
    black --check .
    mypy .
    flake8
    coverage erase
    coverage run --source gso --omit="gso/migrations/*" -m pytest {posargs}
    coverage xml
    coverage html
    sh -c "if [ $SKIP_ALL_TESTS -eq 1 ]; then echo 'Skipping coverage report'; else coverage report --fail-under 80; fi"

allowlist_externals =
    sh