FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
tox.ini 2.25 KiB
Newer Older
Dr Rich Wareham's avatar
Dr Rich Wareham committed
# 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_FLAKE8_VERSION
# - TOXINI_WORK_DIR
#
[tox]
# Envs which should be run by default.
envlist=flake8,doc,py3
# Allow overriding toxworkdir via environment variable
toxworkdir={env:TOXINI_WORK_DIR:{toxinidir}/.tox}
# Avoid .egg-info directories
skipsdist=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=
    -rrequirements.txt
    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
# 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
    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

# Build documentation
[testenv:doc]
basepython=python3
deps=
    -rdoc/requirements.txt
commands=sphinx-build -a -v -b html doc/ {[_vars]build_root}/doc/

# Check for PEP8 violations
[testenv:flake8]
basepython=python3
deps=
#   We specify a specific version of flake8 to avoid introducing "false"
#   regressions when new checks are introduced. The version of flake8 used may
#   be overridden via the TOXINI_FLAKE8_VERSION environment variable.
    flake8=={env:TOXINI_FLAKE8_VERSION:3.6.0}
commands=
    flake8 --version
    flake8 .