forked from ansible/pytest-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
144 lines (135 loc) · 3.55 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]
envlist =
lint,
pkg,
py,
devel,
coverage,
docs
skip_missing_interpreters = true
[testenv]
description =
Run tests
devel: with ansible-core devel branch and without dependencies constraints
commands_pre =
sh -c "rm -f .tox/.coverage.* 2>/dev/null || true"
commands =
coverage run --parallel --source pytest_ansible -m pytest --doctest-glob='*.md' {posargs}
sh -c "coverage combine -a -q --data-file=.coverage .tox/.coverage.*"
passenv =
ANSIBLE_DEBUG
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
SETUPTOOLS_SCM_DEBUG
SSH_AUTH_SOCK # may be needed by git
SSL_CERT_FILE # https proxies
setenv =
ANSIBLE_LOCAL_TEMP = {envdir}/.ansible-local
ANSIBLE_REMOTE_TEMP = {envdir}/.ansible-remote
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
FORCE_COLOR = 1
PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt
devel: PIP_CONSTRAINT = /dev/null
extras =
test
allowlist_externals =
cat
git
rm
sh
tox
coverage
deps =
devel: ansible-core @ git+https://github.com/ansible/ansible.git # GPLv3+
# https://tox.wiki/en/latest/upgrading.html#editable-mode
package = editable
usedevelop = true
[testenv:lint]
deps =
pre-commit
commands =
pre-commit --version
[testenv:clean]
description = Erase coverage data
deps = coverage[toml]
skip_install = true
commands =
coverage erase
[testenv:deps]
description = Bump all test dependencies
# we reuse the lint environment
envdir = {toxworkdir}/lint
skip_install = true
basepython = python3.10
deps =
{[testenv:lint]deps}
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
commands =
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual up
# Update pre-commit hooks
-pre-commit autoupdate
# We fail if files are modified at the end
git diff --exit-code
[testenv:pkg]
description =
Do packaging/distribution
usedevelop = false
# don't install molecule itself in this env
skip_install = true
deps =
build >= 0.9.0
twine >= 4.0.2 # pyup: ignore
setenv =
commands =
rm -rfv {toxinidir}/dist/
python3 -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# metadata validation
sh -c "python3 -m twine check --strict {toxinidir}/dist/*"
# testing installation of the wheel
sh -c 'python3 -m pip install "pytest-ansible @ file://$(echo {toxinidir}/dist/*.whl)"'
# minimal test that pytest finds the plugin:
pytest --inventory=/dev/null --version
# testing uninstallation
python3 -m pip uninstall -y pytest-ansible
[testenv:coverage]
description = Combines and displays coverage results
skip_install = true
usedevelop = false
setenv =
COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml
COVERAGE_FILE = {toxinidir}/.coverage
commands_pre =
commands =
python3 -m coverage --version
# needed by codecov github actions, also ignored result to reach report one.
python3 -m coverage xml
# just for humans running it:
python3 -m coverage report
deps =
coverage[toml]>=7.0.5
[testenv:docs]
description = Builds docs
extras =
docs
setenv =
# Disable colors until markdown-exec supports it:
# https://github.com/pawamoy/markdown-exec/issues/11
NO_COLOR = 1
TERM = dump
skip_install = false
usedevelop = true
commands =
mkdocs build {posargs:}