-
Notifications
You must be signed in to change notification settings - Fork 103
/
tox.ini
170 lines (159 loc) · 4.91 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
[base]
[tox]
envlist =
lint,
py,
report,
packaging,
docs,
clean
minversion = 4.6.3
isolated_build = true
skip_missing_interpreters = true
requires =
# disabled until we make it compatible with tox v4
# ensures that tox returns no zero if git reports dirty after test runs
tox-extra<2.1.0
# allow users using cross-platform mounted drives to use tox:
toxworkdir={env:TOX_WORK_DIR:.tox}
[testenv]
description = Run pytest under {basepython} ({envpython})
# the pytest command line is not in the project.toml because of issues
# with catching breakpoints while debugging unit tests the number of
# CPUs is set to 50% b/c CI timeout failures were more likely the small
# test image is used an alternative to the default, but should be it
# one of it's layer
allowlist_externals =
cat
grep
rm
sh
pre-commit
package = editable
extras =
test
commands =
sh -c 'grep -iFInrq "UPDATE_FIXTURES = True" ./tests && exit 1 || exit 0'
# most coverage options are kept in pyproject.toml
# pytest params are kept in pyproject.toml
# if one wants to control parallelism define PYTEST_XDIST_AUTO_NUM_WORKERS
coverage run -m pytest {posargs:-n=auto --dist=loadfile}
{py,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 --ignore-errors \
"
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
FORCE_COLOR = 1
PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt
PRE_COMMIT_COLOR = always
TERM = xterm-256color
passenv =
ANSIBLE_NAVIGATOR_UPDATE_TEST_FIXTURES
CI
CONTAINER_*
DOCKER_*
GITHUB_*
HOME
PYTEST_*
SSH_AUTH_SOCK
TERM
USER
[testenv:clean]
description = Erase coverage data
deps = coverage[toml]
skip_install = true
commands =
coverage erase
[testenv:deps]
description = Bump all test dependencies
skip_install = true
# Keep python version to min-supported version or pip-tools will fail to
# include those conditional dependencies.
basepython = python3.10
deps =
pip-tools>=6.12.3
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
commands =
pip-compile -q --upgrade --no-annotate --all-extras --output-file=.config/constraints.txt --strip-extras pyproject.toml
[testenv:report]
description = Produce coverage report
deps = coverage[toml]
skip_install = true
commands =
coverage report
cat .tox/.tmp/.mypy/index.txt
[testenv:lint]
description = Enforce quality standards under {basepython} ({envpython})
install_command = pip install {opts} {packages}
commands =
# pre-commit prettier might fix the generated schema file, but that is fine
sh -c "ansible-navigator --ee false settings --schema json > src/ansible_navigator/data/ansible-navigator.json"
pre-commit run {posargs:--show-diff-on-failure \
--hook-stage manual \
--all-files}
deps =
pre-commit
--editable .
setenv =
# NOTE: Although stage=manual hooks are included in the above
# NOTE: pre-commit run, some may not be enforced and should be included
# NOTE: in the skip list below.
# NOTE: Running some of the MyPy checks is disabled here but they may
# NOTE: be reconfigured in the pre-commit configuration file. So the
# NOTE: value of the `SKIP` env var must not be updated separately
# NOTE: from changing the pre-commit setup.
{[testenv]setenv}
PIP_CONSTRAINT = /dev/null
SKIP = cspell, flake8-rule-candidates, mypy-py310
[testenv:no-test-deps]
description = Run smoke(unittest) under {basepython} ({envpython})
deps =
--editable .
ansible-core
commands =
python3 -m unittest tests/smoke/no_test_dependencies.py
[testenv:docs]
deps =
--editable .[docs]
description = Build The Docs
# Intentionally not in alphabetical order due to execution order
commands_pre =
rm -rf .cache/plugin
commands =
mkdocs {posargs:build --strict}
isolated_build = true
passenv =
SSH_AUTH_SOCK
skip_install = false
usedevelop = true
[testenv:packaging]
description =
Build package, verify metadata, install package
deps =
build >= 0.7.0
twine
skip_install = true
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"
# Basic sanity check
ansible-navigator --version
# Uninstall package
pip uninstall -y ansible-navigator