MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / execute

Method execute

render_machine/actions/run_unit_tests.py:18–50  ·  view source on GitHub ↗
(self, render_context: RenderContext, _previous_action_payload: Any | None)

Source from the content-addressed store, hash-verified

16 UNRECOVERABLE_ERROR_OUTCOME = "unrecoverable_error_occurred"
17
18 def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
19 unittests_script = os.path.normpath(render_context.unittests_script)
20
21 console.info(
22 f"Running unit tests script {unittests_script}. (attempt: {render_context.unit_tests_running_context.fix_attempts + 1})"
23 )
24 exit_code, unittests_issue, unittests_temp_log_file_path = render_utils.execute_script(
25 unittests_script,
26 [render_context.build_folder],
27 "Unit Tests",
28 timeout=render_context.test_script_timeout,
29 stop_event=render_context.stop_event,
30 )
31
32 render_context.script_execution_history.latest_unit_test_output_path = unittests_temp_log_file_path
33 render_context.script_execution_history.should_update_script_outputs = True
34 if exit_code == 0:
35 return self.SUCCESSFUL_OUTCOME, None
36
37 elif exit_code in UNRECOVERABLE_ERROR_EXIT_CODES:
38 console.error(unittests_issue)
39
40 return (
41 self.UNRECOVERABLE_ERROR_OUTCOME,
42 RenderError.encode(
43 message="Unit tests script failed due to problems in the environment setup. Please check your environment or update the script for running unittests.",
44 error_type="ENVIRONMENT_ERROR",
45 script=unittests_script,
46 issue=unittests_issue,
47 ).to_payload(),
48 )
49 else:
50 return self.FAILED_OUTCOME, {"previous_unittests_issue": unittests_issue}

Callers

nothing calls this directly

Calls 4

infoMethod · 0.80
errorMethod · 0.80
to_payloadMethod · 0.80
encodeMethod · 0.80

Tested by

no test coverage detected