From c76bd7c923ade77843ec697cf0b3bb153ed46242 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Mon, 1 May 2023 01:23:17 +0200 Subject: [PATCH] group errors on same line --- pytest_github_actions_annotate_failures/plugin.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pytest_github_actions_annotate_failures/plugin.py b/pytest_github_actions_annotate_failures/plugin.py index 1753a77..df79c1d 100644 --- a/pytest_github_actions_annotate_failures/plugin.py +++ b/pytest_github_actions_annotate_failures/plugin.py @@ -104,7 +104,17 @@ def _try_parse_multi_error_string_message(workspace, filesystempath, longrepr): if not all(matches): return None - return [(int(match.group(1)), match.group(2)) for match in matches] + errors_per_line = {} + + for match in matches: + line_no = int(match.group(1)) + message = match.group(2) + if line_no not in errors_per_line: + errors_per_line[line_no] = message + else: + errors_per_line[line_no] += "\n" + message + + return errors_per_line.items() def _error_workflow_command(filesystempath, lineno, longrepr):