-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtox.ini
144 lines (135 loc) · 3.82 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
[tox]
minversion = 4.0.0rc1
envlist =
lint
pkg
docs
# matrix assumed current (implicit) is 2.13:
py38{,-ansible29}
py39{,-devel}
py310{,-devel}
py311{,-devel}
isolated_build = true
skip_missing_interpreters = True
skipsdist = true
[testenv]
description =
Run the tests with {basepython}
devel: ansible devel branch
ansible29: ansible 2.9
ansible210: ansible-base 2.10
ansible211: ansible-base 2.11
ansible212: ansible-core 2.12
ansible213: ansible-core 2.13
ansible214: ansible-core 2.14
deps =
ansible29: ansible>=2.9,<2.10
ansible210: ansible-base>=2.10,<2.11
ansible211: ansible-core>=2.11,<2.12
ansible212: ansible-core>=2.12,<2.13
ansible213: ansible-core>=2.13,<2.14
ansible214: ansible-core>=2.14.0b1,<2.15
devel: ansible-core @ git+https://github.com/ansible/ansible.git # GPLv3+
# avoid installing ansible-core on -devel, ansible29 and ansible210 envs:
!devel-!ansible29-!ansible210: ansible-core
--editable .[test]
commands =
sh -c "ansible --version | head -n 1"
# 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:}
sh -c "coverage xml || true && coverage report"
commands_pre =
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
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
PY_COLORS
REQUESTS_CA_BUNDLE # https proxies
SSL_CERT_FILE # https proxies
LANG
LC_ALL
LC_CTYPE
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
PIP_DISABLE_PIP_VERSION_CHECK = 1
PIP_CONSTRAINT = {toxinidir}/requirements.txt
py38: PIP_CONSTRAINT = /dev/null
PRE_COMMIT_COLOR = always
PYTEST_REQPASS = 78
FORCE_COLOR = 1
allowlist_externals =
ansible
sh
[testenv:lint]
description = Run all linters
# locked basepython is needed because to keep constrains.txt predictable
basepython = python3.9
deps =
pre-commit>=2.6.0
skip_install = true
usedevelop = false
commands =
pre-commit run -a --show-diff-on-failure {posargs:}
pre-commit run -a pip-compile
passenv =
{[testenv]passenv}
PRE_COMMIT_HOME
setenv =
{[testenv]setenv}
PIP_CONSTRAINT = /dev/null
[testenv:deps]
description = Bump all test dependencies
basepython = {[testenv:lint]basepython}
envdir = {toxworkdir}/lint
deps = {[testenv:lint]deps}
skip_install = true
commands =
{[testenv:lint]commands} --hook-stage manual
setenv =
{[testenv]setenv}
PIP_CONSTRAINT = /dev/null
[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
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"
pip uninstall -y ansible-compat
[testenv:py{39,38,37,36}]
description = Run the tests with {basepython} ansible-core 2.11+
deps =
{[testenv]deps}
ansible-core>=2.11
[testenv:docs]
description = Build docs
commands =
python -m sphinx \
-a -n -W \
--keep-going \
-b html {tty:--color} \
-d "{toxworkdir}/doctree" \
docs/ "{toxworkdir}/html"
deps =
--editable .[docs]
passenv = *