[build-system]
requires = []
backend-path = ['src']
build-backend = 'build_backend'
[tool.mypy]
follow_imports = 'silent'
scripts_are_modules = true
explicit_package_bases = true
mypy_path = 'src:test/common:bots'
exclude = [
'tmp/',
'tools/vulture-suppressions/',
'vendor/',
]
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"cockpit._vendor.*",
"lib.*",
"machine.*",
"task.*",
"testvm",
"libvirt",
"libvirt_qemu",
"pika",
"pcp",
"cpmapi",
"gi.*",
"dbus",
"tracer.query",
"sos.*",
"vdo.*",
]
[[tool.mypy.overrides]]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_reexport = true
strict_concatenate = true
strict_equality = true
warn_unused_ignores = true
module = [
'cockpit',
'cockpit._version',
'cockpit.channels.http_channel',
'cockpit.channels.metrics',
'cockpit.channels.pcp',
'cockpit.channels.stream',
'cockpit.channels.trivial',
'cockpit.misc.print',
'cockpit.jsonutil',
'cockpit.packages',
'cockpit.peer',
'cockpit.protocol',
'cockpit.superuser',
'cockpit.transports',
'cockpit.beipack',
'cockpit.samples',
'cockpit.misc.bootloader',
'testlib',
'packagelib',
'netlib',
'storagelib',
'submanlib',
'js_coverage',
'webdriver_bidi',
'run-tests',
'test.pytest.test_beiboot',
'test.pytest.test_packages',
'test.pytest.test_http_channel',
]
[tool.pylint]
max-line-length = 118
disable = [
"C0114",
"C0115",
"C0116",
"R0902",
"R0903",
"R0913",
"R1705",
"W0120",
"W1113",
]
[tool.ruff]
exclude = [
".git/",
"modules/",
"node_modules/",
]
line-length = 118
preview = true
src = []
[tool.ruff.format]
quote-style = "preserve"
[tool.ruff.lint]
select = [
"A",
"B",
"C4",
"D300",
"DTZ",
"E",
"EXE",
"F",
"FBT",
"G",
"I",
"ICN",
"ISC",
"PIE",
"PLE",
"PGH",
"PT",
"RSE",
"RUF",
"T10",
"TC",
"UP032",
"W",
"YTT",
]
ignore = [
"A003",
"B011",
"E731",
"PT011",
"RUF012",
"TC001",
"TC002",
"ICN001",
]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.isort]
known-first-party = ["cockpit", "test.pytest"]
[tool.ty.environment]
extra-paths = ["src", "test/common", "bots"]
[tool.pytest.ini_options]
addopts = ['--strict-markers']
pythonpath = ["src", "test/common", "bots"]
testpaths = ["test/pytest"]
log_cli = true
required_plugins = ["pytest-asyncio"]
asyncio_default_fixture_loop_scope = "function"
[tool.pyright]
strict = ["**"]
extraPaths = ["src", "test/common", "bots"]
[tool.vulture]
paths = [
"src",
"test/pytest",
"tools/vulture_suppressions",
]
ignore_names = [
"do_*",
"pytest_*",
"test[A-Z0-9]*",
"pytestmark",
]
ignore_decorators = [
"@*.getter",
"@*.register_function",
"@bus.Interface.Method",
"@pytest.fixture",
"@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",
"raise NotImplementedError",
]
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = lint,pytest
isolated_build = True
requires = virtualenv<20.22.0
labels =
venv = py3{9,10,11,12,13,14}-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, py39-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.
# These tests will not run the PCP tests as there is no wheel available.
# https://github.com/performancecopilot/pcp/issues/2076
[testenv]
package = wheel
wheel_build_env = venv-pkg
skip_install = lint: True
deps =
lint: mypy
lint: ruff
lint: vulture
pytest
pytest-asyncio
pytest: pytest-cov
pytest: pytest-timeout
pytest: pytest-xdist
allowlist_externals = test/common/static-code
setenv =
NO_QUNIT=1
commands =
pytest: python3 -m pytest -opythonpath=test/common {posargs}
lint: test/common/static-code --tap
"""
[tool.codespell]
skip = '*.map,*.xml,*.policy,*.key,*.svg,./po,./node_modules,./dist,./vendor,./LICENSES,./selinux,./test,./src,./pkg'
ignore-words-list = 'outofdate,ND,bu,chage,re-uses,re-use,afile'