Stabilize Jupyter terminal wrapper execution
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import unittest
|
||||
|
||||
from src.jupyter_runtime import (
|
||||
build_terminal_script_launcher,
|
||||
clean_terminal_output,
|
||||
extract_terminal_command_output,
|
||||
)
|
||||
@@ -43,6 +44,28 @@ class TestJupyterRuntimeOutputFiltering(unittest.TestCase):
|
||||
|
||||
self.assertEqual(cleaned, 'real-output')
|
||||
|
||||
def test_clean_terminal_output_drops_continuation_prompt(self) -> None:
|
||||
cleaned = clean_terminal_output('real-output\r\n# >\r\n')
|
||||
|
||||
self.assertEqual(cleaned, 'real-output')
|
||||
|
||||
def test_terminal_script_launcher_hides_complex_wrapper_from_shell(self) -> None:
|
||||
launcher = build_terminal_script_launcher(
|
||||
script_path='/workspace/scratchpad/.run_scripts/run.sh',
|
||||
marker='__ZK_AGENT_EXIT_test__',
|
||||
)
|
||||
|
||||
self.assertNotIn('setsid bash -lc', launcher)
|
||||
self.assertEqual(
|
||||
launcher,
|
||||
'bash /workspace/scratchpad/.run_scripts/run.sh; '
|
||||
'__zk_outer_status=$?; '
|
||||
'rm -f /workspace/scratchpad/.run_scripts/run.sh; '
|
||||
'if [ "$__zk_outer_status" -ne 0 ]; then '
|
||||
'printf "\\n__ZK_AGENT_EXIT_test__:%s\\n" "$__zk_outer_status"; '
|
||||
'fi',
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user