# This file is part of the django-environ.
#
# Copyright (c) 2021, Serghei Iakovlev <egrep@protonmail.ch>
# Copyright (c) 2013-2021, Daniele Faraglia <daniele.faraglia@gmail.com>
#
# For the full copyright and license information, please view
# the LICENSE.txt file that was distributed with this source code.
# Tox (https://tox.readthedocs.io) - run tests in multiple virtualenvs.
# Also contains configuration settings for all tools executed by Tox.
[tox]
minversion = 3.22
envlist =
build
coverage-report
linkcheck
docs
lint
manifest
py{35,36,37,38,39,310}-django{111,22}
py{36,37,38,39,310}-django{30,31,32}
py{38,39,310}-django{40}
pypy-django{111,22,30,31,32}
[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
pypy-3.7: pypy
[testenv]
description = Unit tests
extras = testing
deps =
django111: Django>=1.11,<2
django22: Django>=2.2,<3.0
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
commands_pre =
python -m pip install --upgrade pip
python -m pip install .
commands =
coverage erase
coverage run -m pytest {posargs}
[testenv:coverage-report]
description = Combine coverage reports
skip_install = true
deps = coverage[toml]>=5.4
commands =
coverage combine
coverage report
coverage html
coverage xml
[testenv:lint]
description = Static code analysis and code style check
skip_install = true
deps =
flake8
flake8-blind-except
flake8-import-order
commands_pre =
python -m pip install --upgrade pip
python -m pip install .
commands = flake8 environ setup.py
[testenv:linkcheck]
description = Check external links in the package documentation
# Keep basepython in sync with .readthedocs.yml and docs.yml
# (GitHub Action Workflow).
basepython = python3.10
extras = docs
commands =
{envpython} -m sphinx \
-j auto \
-b linkcheck \
{tty:--color} \
-n -W -a \
--keep-going \
-d {envtmpdir}/doctrees \
docs \
docs/_build/linkcheck
isolated_build = true
[testenv:docs]
description = Build package documentation (HTML)
# Keep basepython in sync with .readthedocs.yml and docs.yml
# (GitHub Action Workflow).
basepython = python3.10
extras = docs
commands =
{envpython} -m sphinx \
-j auto \
-b html \
{tty:--color} \
-n -T -W \
-d {envtmpdir}/doctrees \
docs \
docs/_build/html
{envpython} -m sphinx \
-j auto \
-b doctest \
{tty:--color} \
-n -T -W \
-d {envtmpdir}/doctrees \
docs \
docs/_build/doctest
{envpython} -m doctest \
AUTHORS.rst \
CHANGELOG.rst \
CONTRIBUTING.rst \
README.rst \
SECURITY.rst
[testenv:manifest]
description = Check MANIFEST.in in a source package for completeness
deps = check-manifest
skip_install = true
commands = check-manifest -v
[testenv:build]
description = Build and test package distribution
skip_install = true
deps =
twine
check-wheel-contents
commands_pre =
python -m pip install -U pip setuptools wheel
python setup.py bdist_wheel -d {envtmpdir}/build
python setup.py sdist -d {envtmpdir}/build
commands =
twine check {envtmpdir}/build/*
check-wheel-contents {envtmpdir}/build
[pytest]
testpaths = tests
addopts =
--verbose
--ignore=.tox
[coverage:run]
branch = True
parallel = True
# A list of file name patterns, the files to leave
# out of measurement or reporting.
omit =
.tox/*
tests/*
*/__pycache__/*
[coverage:report]
precision = 2
show_missing = True
[flake8]
# Base flake8 configuration:
statistics = True
show-source = True
# TODO: max-complexity = 10
# Plugins:
import-order-style = smarkets
# A list of mappings of files and the codes that should be ignored for
# the entirety of the file:
per-file-ignores =
environ/__init__.py:F401,F403
environ/compat.py:F401
# Excluding some directories:
extend-exclude =
.tox
build*
dist
htmlcov