tenseleyflow/bensch / 083a979

Browse files

integrate profiles into test runner session reset

YAMLTestRunner accepts profile dict. Session reset uses
profile's mode_reset_command and prompt_set_command instead of
hardcoded 'set -o emacs; PS1="> "'.

ShellPTY instantiation passes profile through for env config.
Authored by espadonne
SHA
083a9793faa083e0658df9733aed6f231a7c6d12
Parents
d925e95
Tree
e9cbac3

1 changed file

StatusFile+-
M framework/runner.py 10 3
framework/runner.pymodified
@@ -63,10 +63,12 @@ class YAMLTestRunner:
6363
     shell session across multiple tests, resetting state between them.
6464
     """
6565
 
66
-    def __init__(self, shell_path: str, verbose: bool = False, tests_per_session: int = 10):
66
+    def __init__(self, shell_path: str, verbose: bool = False, tests_per_session: int = 10,
67
+                 profile: dict = None):
6768
         self.shell_path = shell_path
6869
         self.verbose = verbose
6970
         self.results: List[TestResult] = []
71
+        self.profile = profile or {}
7072
 
7173
         # Scale timeouts for slower platforms (ARM64, macOS with flang-new)
7274
         import platform
@@ -126,7 +128,8 @@ class YAMLTestRunner:
126128
             self._current_session = ShellPTY(
127129
                 shell_path=self.shell_path,
128130
                 timeout=self.pty_timeout,
129
-                env=env or {}
131
+                env=env or {},
132
+                profile=self.profile,
130133
             )
131134
             self._current_session.start(rc_file=rc_file)
132135
         else:
@@ -163,7 +166,11 @@ class YAMLTestRunner:
163166
 
164167
             # Reset PS1 and editing mode, then echo marker
165168
             marker = f"RESET_{self._test_count}"
166
-            self._current_session.send_line(f" set -o emacs; PS1='> '; echo {marker}")  # leading space to exclude from history
169
+            # Build reset command from profile
170
+            mode_reset = self.profile.get("mode_reset_command", "")
171
+            prompt_set = self.profile.get("prompt_set_command", "PS1='$ '")
172
+            reset_parts = [p for p in [mode_reset, prompt_set, f"echo {marker}"] if p]
173
+            self._current_session.send_line(" " + "; ".join(reset_parts))  # leading space to exclude from history
167174
 
168175
             # Wait for the marker to ensure we're at a clean state
169176
             try: