So far, our ruff config was confined to the f2 package. This meant, that when one added additional paths to the ruff formatter, those wouldn't get the same rules applied as f2, resulting in inconsistent styling thoughout the project. Due to how configs are resolved, only the "closesed" pyproject toml is considered. This means, we need to tell f2 to extend its configuration with the base level one. Though no change is required for other parts of the project, as long as they don't have their own pyproject.toml Change-Id: I145c764e7b850194020b5560e1025f4aa80411ae
60 lines
2.6 KiB
TOML
60 lines
2.6 KiB
TOML
[project]
|
|
name = "functional2"
|
|
version = "2"
|
|
requires-python = ">=3.12"
|
|
|
|
[tool.pytest.ini_options]
|
|
addopts = "-p no:xonsh"
|
|
|
|
# xfail tests should fail when not failing as described
|
|
xfail_strict = true
|
|
|
|
# Keep the temporary files of the last 3 test runs (default value)
|
|
tmp_path_retention_count = 3
|
|
# Keep temporary files of all tests, regardless if they failed or not
|
|
tmp_path_retention_policy = "all"
|
|
|
|
log_cli = true
|
|
log_cli_level = "INFO"
|
|
# how the logs are being printed, default is `"%(filename)s %(lineno)d %(levelname)s %(message)s"`
|
|
# Example log:
|
|
# 2025-05-09T14:06:23Z [ INFO] [test_someting] This is a test message
|
|
# 2025-05-09T14:06:25Z [ ERROR] [test_smt_else] Some error related log
|
|
log_cli_format = "%(asctime)s [%(levelname)8s] [%(name)s] %(message)s"
|
|
log_cli_date_format = "%Y-%m-%dT%H:%M:%SZ"
|
|
|
|
[tool.ruff]
|
|
extend = "../../pyproject.toml"
|
|
|
|
[tool.ruff.lint.flake8-tidy-imports]
|
|
|
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
# Forbid symbols that are footguns in our codebase due to unsafe global state
|
|
"os.environ".msg = """
|
|
Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use:
|
|
- env= in subprocess functions
|
|
- functional2.testlib.commands.Command.with_env for starting subprocesses
|
|
- functional2.testlib.environ for read-only access
|
|
"""
|
|
"os.environb".msg = """
|
|
Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use:
|
|
- env= in subprocess functions
|
|
- functional2.testlib.commands.Command.with_env for starting subprocesses
|
|
- functional2.testlib.environ for read-only access
|
|
"""
|
|
"os.putenv".msg = """
|
|
Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use:
|
|
- env= in subprocess functions
|
|
- functional2.testlib.commands.Command.with_env for starting subprocesses
|
|
- functional2.testlib.environ for read-only access
|
|
"""
|
|
"os.unsetenv".msg = """
|
|
Environment variables are process wide and are unsafe to set as they interfere with other tests. Instead, use:
|
|
- env= in subprocess functions
|
|
- functional2.testlib.commands.Command.with_env for starting subprocesses
|
|
- functional2.testlib.environ for read-only access
|
|
"""
|
|
"os.chdir".msg = "Changing current directory is process wide and may interfere with other tests. Use cwd= while spawning a process instead."
|
|
"os.fchdir".msg = "Changing current directory is process wide and may interfere with other tests. Use cwd= while spawning a process instead."
|
|
"contextlib.chdir".msg = "Changing current directory is process wide and may interfere with other tests. Use cwd= while spawning a process instead."
|