[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/docbow/{env:BRANCH_NAME:}
envlist = {pw,pfwb,mellon,pfwbmellon},codestyle

[testenv]
usedevelop = True
deps =
  django>=3.2.12,<3.3
  pfwb,pfwbmellon: SQLAlchemy-Utils
  mellon: django-mellon
  pfwbmellon: django-mellon
  -r test-requirements.txt
setenv =
  SECRET_KEY=changeme
  pw: PARLEMENT=pw
  pfwb: PARLEMENT=pfwb
  DJANGO_SETTINGS_MODULE=docbow_project.settings
  DOCBOW_SETTINGS_FILE=tests/settings.py
  mellon: DOCBOW_SETTINGS_FILE=tests/sso/settings.py
  pfwbmellon: DOCBOW_SETTINGS_FILE=tests/pfwbmellon/settings.py
  JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml}
  COVERAGE={tty::--cov --cov-append --cov-report xml --cov-report html --cov-context=test --cov-config=tox.ini}
  BRANCH_NAME={env:BRANCH_NAME:}
  pw: TESTFILES=tests/main/ tests/pw/
  pfwb: TESTFILES=tests/main/ tests/pfwb/
  mellon: TESTFILES=tests/sso/
  pfwbmellon: TESTFILES=tests/pfwbmellon/
allowlist_externals =
  ./getlasso3.sh
commands =
  ./getlasso3.sh
  py.test {env:JUNIT:} {env:COVERAGE:} {posargs:{env:TESTFILES:}}

[testenv:codestyle]
skip_install = true
deps =
        pre-commit
commands =
        pre-commit run --all-files --show-diff-on-failure

[coverage:run]
source =
    dowbow_project
    tests
    tests_sso
branch = True

[coverage:html]
show_contexts = True
