# Tox runner configuration
#
# The following optional environment variables can change behaviour. See the
# comments where they are used for more information.
#
# - TOXINI_ARTEFACT_DIR
# - TOXINI_WORK_DIR
#
[tox]
# Envs which should be run by default.
envlist=py3
# Allow overriding toxworkdir via environment variable
toxworkdir={env:TOXINI_WORK_DIR:{toxinidir}/.tox}
# Avoid .egg-info directories
skipsdist=True
isolated_build=True

# The "_vars" section is ignored by tox but we place some useful shared
# variables in it to avoid needless repetition.
[_vars]
# Where to write build artefacts. We default to the "build" directory in the
# tox.ini file's directory. Override with the TOXINI_ARTEFACT_DIR environment
# variable.
build_root={env:TOXINI_ARTEFACT_DIR:{toxinidir}/build}

[testenv]
# Additional dependencies
deps=
    .
    coverage
    pytest
    pytest-cov
# Which environment variables should be passed into the environment.
passenv=
#   Allow people to override the coverage report location should they so wish.
    COVERAGE_FILE
#   Location of the coverage.xml file
    COVERAGE_XML_FILE
skip_install=True
allowlist_externals=
    poetry
commands_pre=
    poetry install --sync
# How to run the test suite. Note that arguments passed to tox are passed on to
# the test command.
commands=
    pytest --doctest-modules --cov={toxinidir} --junitxml={[_vars]build_root}/{envname}/junit.xml {posargs}
    coverage html --directory {[_vars]build_root}/{envname}/htmlcov/
    coverage xml -o {env:COVERAGE_XML_FILE:{[_vars]build_root}/{envname}/coverage.xml}
# Allow sitepackages setting to be overridden via TOX_SITEPACKAGES environment
# variable. The tox container uses this to avoid re-installing the same packages
# over and over again.
sitepackages={env:TOXINI_SITEPACKAGES:False}

[testenv:py3]
basepython=python3