1
1
[tox]
2
- minversion = 4.0
2
+ minversion = 4.6.3
3
3
envlist =
4
4
lint
5
+ pkg
6
+ py
5
7
docs
6
8
ubi8
7
9
ubi9
8
10
isolated_build = True
9
11
requires =
10
- tox>=4.21.2
11
- tox-uv>=1.15.0
12
+ tox>=4.21.2
13
+ tox-extra >= 2.0.1
14
+ tox-uv >= 1.16.0
15
+ setuptools >= 65.3.0 # editable installs
12
16
13
17
[testenv]
18
+ extras =
19
+ test
20
+ commands_pre =
21
+ sh -c " rm -f {envdir}/.coverage.* 2>/dev/null || true"
22
+ # safety measure to assure we do not accidentally run tests with broken dependencies
23
+ {envpython} -m pip check
14
24
commands =
15
- skip_install = true
25
+ coverage run -m pytest {posargs:\
26
+ -ra \
27
+ --showlocals \
28
+ --doctest-modules \
29
+ --durations =10 \
30
+ }
31
+ {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"
32
+ editable = true
33
+ pass_env =
34
+ CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
35
+ FORCE_COLOR
36
+ HOME
37
+ LANG
38
+ LC_*
39
+ NO_COLOR
40
+ PYTEST_* # allows developer to define their own preferences
41
+ PYTEST_REQPASS # needed for CI
42
+ PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
43
+ PY_COLORS
44
+ RTD_TOKEN
45
+ REQUESTS_CA_BUNDLE # https proxies
46
+ SETUPTOOLS_SCM_DEBUG
47
+ SSL_CERT_FILE # https proxies
48
+ SSH_AUTH_SOCK # may be needed by git
49
+ UV_*
50
+ # recreate = True
51
+ setenv =
52
+ COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
53
+ COVERAGE_PROCESS_START ={toxinidir}/pyproject.toml
54
+ skip_install = false
16
55
usedevelop = false
17
56
changedir = {toxinidir}
57
+ allowlist_externals =
58
+ sh
59
+ uv_seed = true
18
60
19
61
[testenv:docs]
20
62
description = Build docs
21
- deps =
22
- -r requirements.in
23
- ansible-core
63
+ extras = docs
24
64
passenv =
25
65
*
66
+ setenv =
67
+ # see https://github.com/tox-dev/tox/issues/2092#issuecomment-2538729079
68
+ # see https://github.com/Kozea/CairoSVG/issues/392#issuecomment-2538707712
69
+ DYLD_FALLBACK_LIBRARY_PATH =/opt/homebrew/lib:{env:DYLD_FALLBACK_LIBRARY_PATH}
26
70
commands =
27
- ; ansible-playbook -i localhost, playbooks/sync.yml
28
71
{envpython} -m mkdocs {posargs:build --strict --site-dir =_readthedocs/html/}
29
- skip_install = true
72
+ skip_install = false
30
73
usedevelop = false
31
74
32
75
[testenv:lint]
@@ -50,3 +93,28 @@ commands =
50
93
podman run -it adt-{envname} adt --version
51
94
allowlist_externals =
52
95
podman
96
+ [testenv:pkg]
97
+ description =
98
+ Build package, verify metadata, install package and assert behavior when ansible is missing.
99
+ deps =
100
+ build >= 0.9.0
101
+ twine >= 4.0.1
102
+ pip
103
+ pipx
104
+ skip_install = true
105
+ # Ref: https://twitter.com/di_codes/status/1044358639081975813
106
+ commands_pre =
107
+ commands =
108
+ # build wheel and sdist using PEP-517
109
+ {envpython} -c ' import os.path, shutil, sys; \
110
+ dist_dir = os.path.join("{toxinidir}", "dist"); \
111
+ os.path.isdir(dist_dir) or sys.exit(0); \
112
+ print("Removing \{ !s\} contents...".format(dist_dir), file=sys.stderr); \
113
+ shutil.rmtree(dist_dir)'
114
+ {envpython} -m build --outdir {toxinidir}/dist/ {toxinidir}
115
+ # Validate metadata using twine
116
+ python3 -m twine check --strict {toxinidir}/dist/*
117
+ # Install the wheel
118
+ sh -c ' python3 -m pip install "team-devtools @ file://$(echo {toxinidir}/dist/*.whl)"'
119
+ # Uninstall it
120
+ python3 -m pip uninstall -y team-devtools
0 commit comments