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 Nov 28, 2024
1 parent 216255e commit b6fc6a7
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.lstrip()}'

Check warning on line 353 in trunner/types.py

View workflow job for this annotation

GitHub Actions / build (3.9)

W291 trailing whitespace

Check warning on line 353 in trunner/types.py

View workflow job for this annotation

GitHub Actions / build (3.10)

W291 trailing whitespace

Check warning on line 353 in trunner/types.py

View workflow job for this annotation

GitHub Actions / build (3.11)

W291 trailing whitespace
for line in remaining_lines
)
else:
remaining_lines = ""

out += ": " + first_line + remaining_lines

return out

Expand Down

0 comments on commit b6fc6a7

Please sign in to comment.