FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
tox.ini 2.29 KiB
# 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. This will execute a matrix of tests
envlist =
    py{36,37,38,39}-django22
    py{36,37,38,39}-django32
    coverage
    flake8
# Allow overriding toxworkdir via environment variable
toxworkdir={env:TOXINI_WORK_DIR:{toxinidir}/.tox}
# Do not attempt to create .egg-info directories in the application root as it
# is mounted as a read-only volume.
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]
setenv=
#   Override the coverage dtaa file location since the application root is
#   mounted read-only.
    COVERAGE_FILE={env:TOXINI_COVERAGE_FILE:{toxinidir}/.coverage}
# Additional dependencies
deps=
    .
    mock
    coverage
    django22: Django>=2.2,<3.0
    django32: Django>=3.2,<3.3
# Specify the default environment.
commands=
    coverage run --source={toxinidir} ./runtests.py

# Check for PEP8 violations
[testenv:flake8]
basepython=python3
deps=
    -rrequirements.txt
#   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.
    mock
    flake8=={env:TOXINI_FLAKE8_VERSION:3.9.2}
commands=
    flake8 --version
    flake8 .

# Check for PEP8 violations
[testenv:coverage]
basepython=python3
deps=
    .
    mock
    coverage
    django
# Specify the default environment. Note that tox will *always* use the testsuite
# settings unless overridden by TOX_DJANGO_SETTINGS_MODULE. Just setting
# DJANGO_SETTINGS_MODULE will not override it.
commands=
    coverage run --source={toxinidir} ./runtests.py
    coverage html --directory {[_vars]build_root}/htmlcov/
    coverage report
    coverage xml -o {env:COVERAGE_XML_FILE:{[_vars]build_root}/coverage.xml}