forked from cockpit-project/cockpit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
150 lines (137 loc) · 3.88 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
[build-system]
requires = []
backend-path = ['src']
build-backend = 'build_backend'
[tool.mypy]
mypy_path = 'src:test/common'
exclude = '_vendor'
[[tool.mypy.overrides]]
module = ["cockpit._vendor.*"]
follow_imports = 'silent'
[tool.pylint]
max-line-length = 118
disable = [
"C0114", # Missing module docstring
"C0115", # Missing class docstring
"C0116", # Missing function or method docstring
"R0902", # Too many instance attributes
"R0903", # Too few public methods
"R0913", # Too many arguments
"R1705", # Unnecessary "else" after "return"
"W0120", # Else clause on loop without a break statement
"W1113", # Keyword argument before variable positional arguments (PEP-570 is Python 3.8)
]
[tool.ruff]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D300", # pydocstyle: Forbid ''' in docstrings
"DTZ", # flake8-datetimez
"E", # pycodestyle
"EXE", # flake8-executable
"F", # pyflakes
"FBT", # flake8-boolean-trap
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"PLE", # pylint errors
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RUF", # ruff rules
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"W", # warnings (mostly whitespace)
"YTT", # flake8-2020
]
exclude = [
".git/",
"modules/",
"node_modules/",
]
ignore = [
"A003", # Class attribute is shadowing a python builtin
"B011", # Do not `assert False` (`python -O` removes these calls), raise `AssertionError()`
"E731", # Do not assign a `lambda` expression, use a `def`
"PT011", # `pytest.raises(OSError)` is too broad
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"TCH001", # Move application import into a type-checking block
]
line-length = 118
src = []
[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.isort]
known-first-party = ["cockpit"]
[tool.pytest.ini_options]
addopts = ['--strict-markers'] # cf. https://github.com/cockpit-project/cockpit/pull/18584#issuecomment-1490243994
pythonpath = ["src"]
testpaths = ["test/pytest"]
log_cli = true
required_plugins = ["pytest-asyncio"]
[tool.vulture]
paths = [
"src",
"test/pytest",
"tools/vulture-suppressions",
]
ignore_names = [
"do_*",
"test[A-Z0-9]*",
]
ignore_decorators = [
"@*.getter",
"@*.register_function",
"@bus.Interface.Method",
"@pytest.hookimpl",
]
[tool.coverage.paths]
source = ["src", "*/site-packages"]
[tool.coverage.run]
concurrency = ["multiprocessing"]
source_pkgs = ["cockpit"]
branch = true
[tool.coverage.report]
show_missing = true
skip_covered = true
exclude_lines = [
"pragma: no cover", # default
"raise NotImplementedError",
]
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = lint,pytest
isolated_build = True
labels =
venv = py311-lint, py3{6,7,8,9,10,11,12}-pytest
# The default test environments use system packages and never PyPI.
[testenv:{lint,pytest}]
sitepackages = True
install_command = python3 -m pip install --no-index --no-build-isolation {opts} {packages}
wheel_build_env = pkg
# All other environments (names like py311-lint, py36-pytest, etc) are isolated
# from the system and get their packages from PyPI, according to the specific
# test environment being requested. We build the wheel in a common environment.
[testenv]
package = wheel
wheel_build_env = venv-pkg
skip_install = lint: True
deps =
lint: mypy
lint: flake8
lint: ruff
lint: vulture
pytest
pytest-asyncio
pytest: pytest-cov
pytest: pytest-timeout
pytest: pytest-xdist
allowlist_externals = test/static-code
commands =
pytest: python3 -m pytest -opythonpath= {posargs}
lint: test/static-code --tap
"""