-
Notifications
You must be signed in to change notification settings - Fork 105
/
tox.ini
164 lines (153 loc) · 4.56 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
[base]
[tox]
envlist =
lint,
py,
report,
packaging,
docs,
clean
minversion = 4.0.2
skipsdist = 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
# 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
deps =
--editable .[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}
sh -c "coverage combine -q .tox/.coverage.* && coverage xml || true && coverage report"
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
FORCE_COLOR = 1
PIP_CONSTRAINT = {toxinidir}/requirements.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.9
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 --extra test --extra docs --output-file=requirements.txt --strip-extras setup.cfg
[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 =
python -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 build {posargs:--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