From c0ca8854c5f50e7cf13ee3b44ac84ff73cce48e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicki=20K=C5=99=C3=AD=C5=BEek?= Date: Thu, 26 Jun 2025 18:20:06 +0200 Subject: [PATCH] Log assertion failures right after test result The extra messages are typically traceback from assertion failures. Previously, they'd be printed only after all individual test case results have been printed. That made it difficult to pair the traceback to the failing test in some cases, as the node information (aka test name) might not always be present. Instead, log any extra messages related to a particular test failure directly after reporting its result, making the failure details more readily available and easy to connect with a particular test case. (cherry picked from commit fcf31417ddee33be028f69a1ea4326ccede46d78) --- bin/tests/system/conftest.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/tests/system/conftest.py b/bin/tests/system/conftest.py index 1393b0266a..7f3c0eb0fb 100644 --- a/bin/tests/system/conftest.py +++ b/bin/tests/system/conftest.py @@ -360,13 +360,13 @@ def system_test_dir(request, system_test_name, expected_artifacts): if node.nodeid in all_test_results } assert len(test_results) - messages = [] for node, result in test_results.items(): - isctest.log.debug("%s %s", result.outcome.upper(), node) - messages.extend(result.messages.values()) - for message in messages: - if message: - isctest.log.debug("\n" + message) + message = f"{result.outcome.upper()} {node}" + nonempty_extra = [msg for msg in result.messages.values() if msg.strip()] + if nonempty_extra: + message += "\n" + message += "\n\n".join(nonempty_extra) + isctest.log.debug(message) failed = any(res.outcome == "failed" for res in test_results.values()) skipped = any(res.outcome == "skipped" for res in test_results.values()) if failed: