[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/barbacompta/{env:BRANCH_NAME:}
envlist = py3,code-style

[tox:jenkins]
envlist =
  code-style
  py3
  pylint

[testenv]
setenv =
  DJANGO_SETTINGS_MODULE=eo_gestion.settings
  BARBACOMPTA_SETTINGS_FILE=tests/settings.py
  JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml}
  COVERAGE_CONFIG=--cov --cov-append --cov-report xml --cov-report html --cov-config=tox.ini
  COVERAGE={tty::{env:COVERAGE_CONFIG}}
# run with "-e py3-coverage" to get coverage
  coverage: COVERAGE={env:COVERAGE_CONFIG}
deps =
  -rtest-requirements.txt
  factur-x==1.8
commands =
  py.test {env:COVERAGE:} {env:JUNIT:} {posargs}

#
# pytest config
#

[pytest]
filterwarnings=
  ignore:Using or importing the ABCs from
junit_family=xunit2

[testenv:manage]
setenv =
  DJANGO_SETTINGS_MODULE=eo_gestion.settings
deps =
  psycopg2-binary
  ipython
commands =
  ./manage.py {posargs:--help}

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

[testenv:pylint]
basepython = python3
deps =
  -rtest-requirements.txt
  pylint
  pylint-django
commands =
  ./pylint.sh eo_gestion/ tests/
