-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
tox.ini
86 lines (82 loc) · 2.75 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
[tox]
minversion = 4.23.2
envlist =
lint
pkg
docs
py
tox_pyenv_fallback = True
ignore_errors = False
isolated_build = True
[testenv]
sitepackages=False
commands_pre =
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
# cleaning needed to prevent errors between runs
sh -c "rm -f {envdir}/.coverage.* 2>/dev/null || true"
commands=
# We add coverage options but not making them mandatory as we do not want to force
# pytest users to run coverage when they just want to run a single test with `pytest -k test`
coverage run -m pytest {posargs:}
# needed for upload to codecov.io
{py,py39,py310,py311,py312,py313}: sh -c "coverage combine -q --data-file={envdir}/.coverage {envdir}/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --ignore-errors --fail-under=0 && COVERAGE_FILE={envdir}/.coverage coverage lcov --fail-under=0 --ignore-errors -q && COVERAGE_FILE={envdir}/.coverage coverage report --fail-under=0 --ignore-errors"
# lcov needed for vscode integration due to https://github.com/ryanluker/vscode-coverage-gutters/issues/403
editable = true
extras = test
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
NO_COLOR
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
PY_COLORS
RTD_TOKEN
REQUESTS_CA_BUNDLE # https proxies
SETUPTOOLS_SCM_DEBUG
SSL_CERT_FILE # https proxies
SSH_AUTH_SOCK # may be needed by git
LANG
LC_*
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
PIP_DISABLE_PIP_VERSION_CHECK = 1
allowlist_externals =
sh
[testenv:lint]
deps =
pre-commit>=3.3.3
commands=
{envpython} -m pre_commit run --all
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.7.0
pip
twine
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
[testenv:docs]
description = Build docs
commands =
mkdocs {posargs:build}
extras = docs
passenv = *