-
Notifications
You must be signed in to change notification settings - Fork 126
/
pyproject.toml
435 lines (394 loc) · 13.2 KB
/
pyproject.toml
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "tmt"
dynamic = ["version"]
description = "Test Management Tool"
readme = "README.rst"
license = "MIT"
license-files = { paths = ["LICENSE"] }
requires-python = ">=3.9"
authors = [
{ name = "Petr Splichal", email = "psplicha@redhat.com" },
]
maintainers = [
{ name = "Petr Splichal", email = "psplicha@redhat.com" },
]
keywords = [
"metadata",
"testing",
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.11",
"Topic :: Utilities",
"Topic :: Software Development :: Testing",
"Operating System :: POSIX :: Linux",
]
dependencies = [ # F39 / PyPI
"click>=8.0.3,!=8.1.4", # 8.1.3 / 8.1.6 TODO type annotations tmt.cli.Context -> click.core.Context click/issues/2558
"docutils>=0.16", # 0.16 is the current one available for RHEL9
"fmf>=1.4.0",
"jinja2>=2.11.3", # 3.1.2 / 3.1.2
"packaging>=20", # 20 seems to be available with RHEL8
"pint>=0.16.1", # 0.16.1
"pygments>=2.7.4", # 2.7.4 is the current one available for RHEL9
"requests>=2.25.1", # 2.28.2 / 2.31.0
"ruamel.yaml>=0.16.6", # 0.17.32 / 0.17.32
"urllib3>=1.26.5, <3.0", # 1.26.16 / 2.0.4
"typing-extensions>=4.9.0; python_version < '3.13'",
]
[project.optional-dependencies]
test-convert = [
"html2text>=2020.1.16",
"markdown>=3.3.4",
"nitrate>=1.8.2",
"python-bugzilla>=3.2.0",
]
export-polarion = [
"pylero>=0.0.8",
]
provision-beaker = [
"mrack>=1.15.1",
]
provision-virtual = [
"testcloud>=0.11.3",
]
provision-container = []
report-junit = [
# Required to support XML parsing and checking the XSD schemas.
"lxml>=4.6.5",
]
report-polarion = [
"tmt[report-junit]",
"tmt[export-polarion]",
]
link-jira = [
"jira>=3.5.0, <4",
]
all = [
"tmt[test-convert]",
"tmt[export-polarion]",
"tmt[provision-container]",
"tmt[provision-virtual]",
"tmt[provision-beaker]",
"tmt[report-junit]",
"tmt[report-polarion]",
"tmt[link-jira]",
]
# Needed for readthedocs and man page build. Not being packaged in rpm.
docs = [
"renku-sphinx-theme==0.4.0",
"readthedocs-sphinx-ext",
"docutils>=0.18.1",
"Sphinx==7.3.7",
"fmf>=1.4.0",
]
[project.scripts]
tmt = "tmt.__main__:run_cli"
[project.urls]
Homepage = "https://github.com/teemtee/tmt"
[tool.hatch.version]
source = "vcs"
raw-options.version_scheme = "release-branch-semver"
[tool.hatch.build.targets.sdist]
include = [
"/tmt",
"/LICENSE",
"/examples",
"/README.rst",
"/tests",
"/tmt.spec",
"/tmt.1",
"/completions",
"/.fmf",
]
artifacts = ["tmt.1"]
[tool.hatch.envs.default]
platforms = ["linux"]
[tool.hatch.envs.dev]
description = "Development environment"
dependencies = [
"autopep8",
"ruff",
"mypy",
"pytest",
"python-coveralls",
"pytest-container",
"pytest-xdist",
"requre",
"yq==3.1.1",
"pre-commit",
# Do not install *types-click* - it's not recommended with Click 8 & newer,
# which is the version a developer encounters given the requirements are not
# frozen.
"types-Markdown",
# prevent conflict between types-requests and urllib3
"types-requests<2.31.0.7; python_version < '3.10'",
"types-requests; python_version >= '3.10'",
"types-setuptools",
"types-jsonschema",
"types-urllib3",
"types-jinja2",
"types-babel",
"types-docutils",
"types-lxml",
]
features = ["all"]
[tool.hatch.envs.dev.scripts]
lint = ["autopep8 {args:.}", "ruff --fix {args:.}"]
type = ["mypy {args:tmt}"]
check = ["lint", "type"]
unit = "make images-tests && pytest -vvv -ra --showlocals -n 0 tests/unit"
smoke = "pytest -vvv -ra --showlocals -n 0 tests/unit/test_cli.py"
cov = [
"coverage run --source=tmt -m pytest -vvv -ra --showlocals -n 0 tests",
"coverage report",
"coverage annotate",
]
requre = [
"cd {root}/tests/integration",
"pytest -vvv -ra --showlocals -n 0",
"requre-patch purge --replaces :milestone_url:str:SomeText --replaces :latency:float:0 tests/integration/test_data/test_nitrate/*",
]
[tool.hatch.envs.dev-not-editable]
template = "dev"
description = "Same as 'dev', but not using editable install"
dev-mode = false
[tool.hatch.envs.test]
template = "dev"
description = "Run scripts with multiple Python versions"
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.11", "3.12"]
[tool.hatch.envs.docs]
dependencies = ["tmt[docs]"]
[tool.hatch.envs.docs.scripts]
# Note that in RTD there are a few additional flags (from RTD's default build
# script) e.g. -E, -d, and -D. These should not affect generated documentation
# files below, but it may be providing additional metadata for RTD to index.
html = "sphinx-build -b html {root}/docs {root}/docs/_build {args}"
linkcheck = "sphinx-build -b linkcheck {root}/docs {root}/docs/_build {args}"
man = [
"cp {root}/docs/header.txt {root}/man.rst",
"tail -n+8 docs/overview.rst >> {root}/man.rst",
# TODO rst2man cannot process this directive, removed for now
"sed '/versionadded::/d' -i {root}/man.rst",
"rst2man.py {root}/man.rst > {root}/tmt.1",
"rm -f {root}/man.rst",
]
[dirs.env]
virtual = ".venv"
[tool.mypy]
# Be vewy, vewy stwict, we'we hunting wabbits^Wbugs.
strict = true
# Automagically make imported object part of mypy's view of module's namespace.
implicit_reexport = true
# Make error messages more rich, this helps better targeted waivers.
show_error_codes = true
# Allow mypy to follow imports to get correct picture of type
# annotations across module boundaries.
follow_imports = "normal"
python_version = "3.9"
files = ["tmt/"]
[[tool.mypy.overrides]]
module = [
"bugzilla.*",
"gssapi.*",
"guestfs.*",
"html2text.*",
"fmf.*",
"lxml.*",
"libvirt.*",
"nitrate.*",
"pylero.*",
"testcloud.*",
"mrack.*",
]
ignore_missing_imports = true
[tool.pyright]
include = [
"tmt/**/*.py",
]
ignore = [
"docs/**",
"examples/**",
"tests/**",
"tmt/export/*.py",
"tmt/plugins/*.py",
"tmt/steps/*.py",
"tmt/steps/discover/*.py",
"tmt/steps/execute/*.py",
"tmt/steps/finish/*.py",
"tmt/steps/prepare/feature.py",
"tmt/steps/prepare/__init__.py",
"tmt/steps/prepare/install.py",
"tmt/steps/provision/*.py",
"tmt/steps/report/__init__.py",
"tmt/steps/report/polarion.py",
"tmt/steps/report/reportportal.py",
"tmt/__init__.py",
"tmt/base.py",
"tmt/convert.py",
"tmt/lint.py",
"tmt/queue.py",
"tmt/utils/__init__.py",
"tmt/utils/structured_field.py",
"tmt/hardware.py", # pyright does not pick up pint's _typing.py or something :/
]
pythonVersion = "3.9"
pythonPlatform = "Linux"
# Be vewy, vewy stwict, we'we hunting wabbits^Wbugs.
typeCheckingMode = "strict"
# Kicking off with some common issues we put aside for now. We might re-enable
# these checks later, or not, but for now they are not useful.
reportMissingTypeStubs = false # Stub file not found for "foo.bar"
reportPrivateUsage = false
reportUnknownMemberType = false
reportUnnecessaryCast = false # Unnecessary "cast" call; type is already...
[tool.autopep8]
max_line_length = 99
in-place = true
recursive = true
hang-closing = true
aggressive = 2
[tool.pep8]
max-line-length = "99"
[tool.ruff]
line-length = 99
src = ["tmt", "tests"]
target-version = "py39"
lint.select = [
"F", # pyflakes
"E", # pycodestyle error
"W", # pycodestyle warning
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"UP", # pyupgrade
"YTT", # flake8-2020
"ASYNC", # flake8-async
"S", # flake8-bandit
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EXE", # flake8-executable
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"G", # flake8-logging-format
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q003", # avoidable-escaped-quote
"Q004", # unnecessary-escaped-quote
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"INT", # flake8-gettext
"PGH", # pygrep-hooks
"PLC", # pylint-convention
"PLE", # pylint-error
"PLR", # pylint-refactor
"FLY", # flynt
"FURB", # refurb
"RUF", # ruff
"D", # pydocstyle
]
lint.ignore = [
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ...
"COM812", # Trailing comma missing
"G004", # Logging statement uses f-string
"PIE790", # Unnecessary `pass` statement
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
"PLE1205", # Too many arguments for `logging` format string
"PLR09", # Too many branches/statements/arguments/returns
"PLR2004", # Magic value used in comparison
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF013", # PEP 484 prohibits implicit `Optional`
# flake8-bandit (S) https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"S101", # Use of `assert` detected
"S603", # `subprocess` call: check for execution of untrusted input
"S607", # Starting a process with a partial executable path
"S105", # Possible hardcoded password assigned to: "PASS"
"SIM103", # Return the condition directly - can hurt readability
# pydocstyle
# TODO: the permanent list (drop this comment once the temporary list
# below gets to zero items...)
"D203", # 1 blank line required before class docstring
# TODO: the temporary list - some of these will be enabled in their
# own patches
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary line and description
"D210", # No whitespaces allowed surrounding docstring text
"D212", # Multi-line docstring summary should start at the first line
"D301", # Use r""" if any backslashes in a docstring
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D415", # First line should end with a period, question mark, or exclamation point
]
lint.logger-objects = ["tmt.log.Logger"]
lint.typing-modules = ["tmt._compat.typing"]
[tool.ruff.lint.per-file-ignores]
# Less strict security checks in tests
"tests/unit*" = [
"S604", # Function call with shell=True parameter identified, security issue
"S605", # Starting a process with a shell: seems safe, but may be changed in the future
"S318", # Using xml to parse untrusted data is known to be vulnerable to XML attacks
"S108", # Probable insecure usage of temporary file or directory: "{}"
"FLY002", # Use f-string instead of .join
]
# The purpose of tmt/_compat is to be used with TID251 (banned imports)
"tmt/_compat/**.py" = ["TID251"]
"docs/conf.py" = ["TID251"]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ["tmt.utils.field"]
[tool.ruff.lint.pydocstyle]
# "The PEP 257 convention includes all D errors apart from: D203, D212,
# D213, D214, D215, D404, D405, D406, D407, D408, D409, D410, D411, D413,
# D415, D416, and D417."
#
# See https://docs.astral.sh/ruff/faq/#does-ruff-support-numpy-or-google-style-docstrings for
# the most up-to-date info.
convention = "pep257"
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["help", "format", "input", "filter", "copyright", "max"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.TypeAlias".msg = "Use tmt._compat.typing.TypeAlias instead."
"typing_extensions.TypeAlias".msg = "Use tmt._compat.typing.TypeAlias instead."
"typing.Self".msg = "Use tmt._compat.typing.Self instead."
"typing_extensions.Self".msg = "Use tmt._compat.typing.Self instead."
"pathlib.Path".msg = "Use tmt._compat.pathlib.Path instead."
"pathlib.PosixPath".msg = "Use tmt._compat.pathlib.Path instead."
"warnings.deprecated".msg = "Use tmt._compat.warnings.deprecated instead."
"os.path".msg = "Use tmt._compat.pathlib.Path and pathlib instead."
# Banning builtins is not yet supported: https://github.com/astral-sh/ruff/issues/10079
# "builtins.open".msg = "Use Path.{write_text,append_text,read_text,write_bytes,read_bytes} instead."
[tool.ruff.lint.isort]
known-first-party = ["tmt"]
[tool.pytest.ini_options]
markers = [
"containers: tests which need to spawn containers",
"web: tests which need to access the web"
]
[tool.codespell]
ignore-words = "docs/codespell.dic"
exclude-file = "docs/codespell.ignore"
skip = "tests/execute/weird/data/weird.txt,tests/lint/plan/data/invalid_attr.fmf,tests/lint/plan/test.sh"
[tool.djlint]
use_gitignore=true
ignore="H005,H030,H031"