-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathtox.ini
More file actions
122 lines (112 loc) · 3.5 KB
/
tox.ini
File metadata and controls
122 lines (112 loc) · 3.5 KB
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
[tox]
envlist =
linters
unit
integration
isolated_build = True
[python-cli-options]
byte-warnings = -b
byte-errors = -bb
max-isolation = -E -s -I
some-isolation = -E -s
warnings-to-errors = -Werror
[shared]
pytest_cov_args = --cov --cov-report html --cov-report term --cov-report xml
[testenv]
description = Run all tests with {basepython}
usedevelop = True
deps =
-r {toxinidir}/test/requirements.txt
commands = pytest -n auto {posargs}
[testenv:linters{,-py39,-py310,-py311,-py312,-py313,-py314}]
description = Run code linters
commands =
flake8 --version
flake8 src/ansible_builder test
yamllint --version
yamllint -s .
mypy src/ansible_builder
pylint src/ansible_builder test
[testenv:unit{,-py39,-py310,-py311,-py312,-py313,-py314}]
description = Run unit tests
setenv =
NO_COLOR=1
passenv =
NO_COLOR
commands = pytest -n auto test/unit {[shared]pytest_cov_args} {posargs}
[testenv:pulp-integration{-py39,-py310,-py311,-py312,-py313,-py314}]
# Some of these tests must run serially because of a shared resource
# (the system policy.json file).
description = Run pulp integration tests
commands =
pytest -n auto -m "not serial" test/pulp_integration {[shared]pytest_cov_args} {posargs}
pytest -n 0 -m "serial" test/pulp_integration {[shared]pytest_cov_args} {posargs}
[testenv:integration{,-py39,-py310,-py311,-py312,-py313,-py314}]
description = Run integration tests
setenv =
NO_COLOR=1
# rootless podman reads $HOME
passenv =
HOME
KEEP_IMAGES
NO_COLOR
commands =
pytest -n auto -m "not serial" test/integration {[shared]pytest_cov_args} {posargs}
pytest -n 0 -m "serial" test/integration {[shared]pytest_cov_args} {posargs}
[testenv:build-docs]
# NOTE: Passing the `is_unversioned` tag speeds up rebuilds in dev env
description = Build The Docs
changedir = docs{/}
commands =
{envpython} \
{[python-cli-options]byte-errors} \
{[python-cli-options]max-isolation} \
{[python-cli-options]warnings-to-errors} \
-m sphinx \
-j auto \
-b html \
{tty:--color} \
-a \
-n \
-W --keep-going \
-T -E \
-d '{temp_dir}{/}.doctrees' \
. \
{posargs:{envtmpdir}{/}html -t is_unversioned}
commands_post =
# Print out the output docs dir and a way to serve html:
{envpython} \
{[python-cli-options]byte-errors} \
{[python-cli-options]max-isolation} \
{[python-cli-options]warnings-to-errors} \
-c\
'import os, pathlib;\
IS_RTD_ENV = os.getenv("READTHEDOCS", "False") == "True";\
docs_dir = pathlib.Path(r"{envdir}") / r"{envtmpdir}" / "html";\
index_file = docs_dir / "index.html";\
docs_url = os.environ["READTHEDOCS_CANONICAL_URL"] if IS_RTD_ENV \
else f"file://\{index_file\}";\
print(f"\nTo open the documentation, run\n\n\
\tpython3 -Im webbrowser \
\N\{QUOTATION MARK\}\{docs_url !s\}\N\{QUOTATION MARK\}\n");\
not IS_RTD_ENV and \
print(f"To serve \
the docs with a local web server, use\n\n\
\tpython3 -Im http.server --directory \
\N\{QUOTATION MARK\}\{docs_dir\}\N\{QUOTATION MARK\} 0\n")'
deps =
-r{toxinidir}{/}docs{/}requirements.txt
pass_env =
{[testenv]pass_env}
READTHEDOCS* # Present @ RTD
[testenv:clean]
description = Erase docs and coverage artifacts
deps =
skip_install = True
allowlist_externals = /bin/sh
commands =
/bin/sh -c "rm -rf {toxinidir}/test/coverage/*"
/bin/sh -c "rm -frv {toxworkdir}{/}build-docs{/}tmp {temp_dir}{/}.doctrees"
[flake8]
ignore = W503
max-line-length = 160