From 046cb38436e37b30fc9b1de4525196428720038a Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 26 Sep 2025 13:41:26 -0700 Subject: [PATCH 1/2] Produce INFO summary only if `-v` is present and `--iterations` is not present (to avoid a distracting flood of output). --- cuda_pathfinder/tests/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cuda_pathfinder/tests/conftest.py b/cuda_pathfinder/tests/conftest.py index cfef9a9544..378c82eecf 100644 --- a/cuda_pathfinder/tests/conftest.py +++ b/cuda_pathfinder/tests/conftest.py @@ -9,7 +9,16 @@ def pytest_configure(config): config.custom_info = [] +def _cli_has_flag(args, flag): + return any(arg == flag or arg.startswith(flag + "=") for arg in args) + + def pytest_terminal_summary(terminalreporter, exitstatus, config): # noqa: ARG001 + if not config.getoption("verbose"): + return + if _cli_has_flag(config.invocation_params.args, "--iterations"): + return + if config.custom_info: terminalreporter.write_sep("=", "INFO summary") for msg in config.custom_info: From 3f7c742a1c126cf339caff32055df04330b18250 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 26 Sep 2025 14:54:28 -0700 Subject: [PATCH 2/2] Even simpler implementation, also handle `pytest-repeat` `--count` while we're at it. --- cuda_pathfinder/tests/conftest.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cuda_pathfinder/tests/conftest.py b/cuda_pathfinder/tests/conftest.py index 378c82eecf..42cff8ac52 100644 --- a/cuda_pathfinder/tests/conftest.py +++ b/cuda_pathfinder/tests/conftest.py @@ -9,14 +9,12 @@ def pytest_configure(config): config.custom_info = [] -def _cli_has_flag(args, flag): - return any(arg == flag or arg.startswith(flag + "=") for arg in args) - - def pytest_terminal_summary(terminalreporter, exitstatus, config): # noqa: ARG001 if not config.getoption("verbose"): return - if _cli_has_flag(config.invocation_params.args, "--iterations"): + if hasattr(config.option, "iterations"): # pytest-freethreaded runs all tests at least twice + return + if getattr(config.option, "count", 1) > 1: # pytest-repeat return if config.custom_info: