Skip to content

Commit

Permalink
trunner: add formatting to subresult message with newlines
Browse files Browse the repository at this point in the history
JIRA: CI-519
  • Loading branch information
adamdebek committed Dec 4, 2024
1 parent 5927813 commit 0289e9e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion trunner/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,18 @@ def __str__(self) -> str:
out = f"\t{bold(self.subname)}: {self.status}"

if self.msg and self.status != Status.OK:
out += ": " + self.msg
shift_length = len(f"{self.subname}: {self.status.name}: ")
first_line, *remaining_lines = self.msg.splitlines()
# Make msg with newlines aligned
if remaining_lines:
remaining_lines = "\n" + "\n".join(
f'\t{" " * shift_length}{line}'
for line in remaining_lines
)
else:
remaining_lines = ""

out += ": " + first_line + remaining_lines

return out

Expand Down

0 comments on commit 0289e9e

Please sign in to comment.