-
Notifications
You must be signed in to change notification settings - Fork 13
/
tox.ini
120 lines (116 loc) · 3.36 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
[tox]
minversion = 4.6.3
envlist =
lint
pkg
py
docs
ubi8
ubi9
isolated_build = True
requires =
tox>=4.21.2
tox-extra >= 2.0.1
tox-uv >= 1.16.0
setuptools >= 65.3.0 # editable installs
[testenv]
extras =
test
commands_pre =
sh -c "rm -f {envdir}/.coverage.* 2>/dev/null || true"
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
commands =
coverage run -m pytest {posargs:\
-ra \
--showlocals \
--doctest-modules \
--durations=10 \
}
{py,py310,py311,py312,py313}: sh -xc "coverage combine -a -q --data-file={envdir}/.coverage {toxworkdir}/*/.coverage.* && coverage report --data-file={envdir}/.coverage && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml"
editable = true
pass_env =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
LANG
LC_*
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
UV_*
# recreate = True
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
skip_install = false
usedevelop = false
changedir = {toxinidir}
allowlist_externals =
sh
uv_seed = true
[testenv:docs]
description = Build docs
extras = docs
passenv =
*
setenv =
# see https://github.com/tox-dev/tox/issues/2092#issuecomment-2538729079
# see https://github.com/Kozea/CairoSVG/issues/392#issuecomment-2538707712
DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:{env:DYLD_FALLBACK_LIBRARY_PATH}
commands =
{envpython} -m mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}
skip_install = false
usedevelop = false
[testenv:lint]
description = Runs all linting tasks
basepython = python3.12
commands =
# to run a single linter you can do "pre-commit run flake8"
python3 -m pre_commit run {posargs:--all}
deps =
pre-commit>=4.0.1
pre-commit-uv>=4.1.4
extras =
skip_install = true
usedevelop = false
[testenv:{ubi8,ubi9}]
description = Building container using beta RPMs (requires VPN) {envname}
changedir = test/{envname}
commands =
podman build --tag adt-{envname} {posargs} .
podman run -it adt-{envname} adt --version
allowlist_externals =
podman
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.9.0
twine >= 4.0.1
pip
pipx
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands_pre =
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
python3 -m twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c 'python3 -m pip install "team-devtools @ file://$(echo {toxinidir}/dist/*.whl)"'
# Uninstall it
python3 -m pip uninstall -y team-devtools