This first geralizes the `nix` fixture with `pytest_generate_tests` to iterate over all protocols (unless they are marked with `no_daemon`), though for now the list of protocols is set to be empty. The lang tests are all tagged with `no_daemon` because they are mostly pure and running them multiple times would be wasteful. Co-authored-by: rootile <lix@rootile.de> Co-authored-by: piegames <git@piegames.de> Change-Id: Ib407edb420ba4bf434cacf9563a71f5ae6fa8eef
82 lines
3.4 KiB
TOML
82 lines
3.4 KiB
TOML
[project]
|
|
name = "functional2"
|
|
version = "2"
|
|
requires-python = ">=3.12"
|
|
|
|
[tool.pytest.ini_options]
|
|
addopts = "-p no:xonsh"
|
|
|
|
markers = ["full_sandbox: test requires a fully isolated sandbox", "no_daemon: only use the local store for this test and do not test the daemon protocol implementations"]
|
|
|
|
# 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"
|
|
|
|
# By default, Pytest attempts to helpfully exclude searching for tests in
|
|
# `build` directories.
|
|
#
|
|
# Unfortunately, we have a directory of tests named `build` in this directory
|
|
# (not to be confused with the top-level Meson `build` directory;
|
|
# `tests/functional2/build/` != `build/`).
|
|
#
|
|
# These are glob expressions.
|
|
# See: https://docs.pytest.org/en/stable/reference/reference.html#confval-norecursedirs
|
|
norecursedirs = [ '.*' ]
|
|
|
|
[tool.ruff]
|
|
extend = "../../pyproject.toml"
|
|
|
|
[tool.ruff.lint]
|
|
# T20: disallow prints in favor of using a logger for better tap compatibility
|
|
extend-select = ["T20"]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# ignore open() and os.path.join() calls in test_evil_nars, as that file is working with raw bytes
|
|
# which pathlib does not support
|
|
"**/store/test_evil_nars.py" = ["PTH118", "PTH123"]
|
|
|
|
[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
|
|
- testlib.commands.Command.with_env for starting subprocesses
|
|
- 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
|
|
- testlib.commands.Command.with_env for starting subprocesses
|
|
- 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
|
|
- testlib.commands.Command.with_env for starting subprocesses
|
|
- 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
|
|
- testlib.commands.Command.with_env for starting subprocesses
|
|
- 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."
|