Skip to content

Commit f250de4

Browse files
author
Nejc Stebe
committed
add unit test stdout (error details) to renderFailed state
1 parent c28e57c commit f250de4

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

render_machine/actions/run_unit_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any |
3434
return self.SUCCESSFUL_OUTCOME, None
3535

3636
elif exit_code in UNRECOVERABLE_ERROR_EXIT_CODES:
37-
console.error(unittests_issue)
3837
return (
3938
self.UNRECOVERABLE_ERROR_OUTCOME,
4039
RenderError.encode(
4140
message="Unit tests script failed due to problems in the environment setup. Please check your environment or update the script for running unittests.",
4241
error_type="ENVIRONMENT_ERROR",
4342
exit_code=exit_code,
4443
script=render_context.unittests_script,
44+
issue=unittests_issue,
4545
).to_payload(),
4646
)
4747
else:

render_machine/render_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23
import signal
34
import subprocess
45
import sys
@@ -125,6 +126,10 @@ def execute_script( # noqa: C901
125126
stdout = ""
126127
elapsed_time = time.time() - start_time
127128

129+
erase_display_pattern = re.compile(r"(?:\033\[[^a-zA-Z]*[a-zA-Z])*\033\[2J(?:\033\[[^a-zA-Z]*[a-zA-Z])*")
130+
parts = erase_display_pattern.split(stdout)
131+
stdout = parts[-1] if len(parts) > 1 else stdout
132+
128133
# Log the info about the script execution
129134
if verbose:
130135
with tempfile.NamedTemporaryFile(

0 commit comments

Comments
 (0)