55from pathlib import Path
66
77
8+ def prompt_yes_no (prompt ):
9+ """Prompt user and wait for a single key: Enter=yes, Escape=no.
10+
11+ Returns True for yes, False for no.
12+ """
13+ print (f" [MANUAL] { prompt } [Entree=oui / Echap=non] " , end = "" , flush = True )
14+ try :
15+ import tty
16+ import termios
17+ fd = sys .stdin .fileno ()
18+ old = termios .tcgetattr (fd )
19+ try :
20+ tty .setraw (fd )
21+ ch = sys .stdin .read (1 )
22+ finally :
23+ termios .tcsetattr (fd , termios .TCSADRAIN , old )
24+ print () # newline after keypress
25+ return ch in ("\r " , "\n " )
26+ except (ImportError , OSError ):
27+ # Fallback for non-Unix or piped stdin
28+ response = input ("" )
29+ return response .strip ().lower () in ("" , "y" , "yes" )
30+
31+
832def load_driver_mock (driver_name , fake_i2c , module_name = None ):
933 """Load a driver using FakeI2C on CPython.
1034
@@ -86,6 +110,7 @@ def cleanup_driver(driver_name, module_name=None):
86110 del sys .modules [mod_name ]
87111 sys .modules .pop ("machine" , None )
88112 sys .modules .pop ("micropython" , None )
113+ sys .modules .pop ("framebuf" , None )
89114
90115
91116def run_action (action , driver_instance ):
@@ -109,8 +134,7 @@ def run_action(action, driver_instance):
109134
110135 if action_type == "manual" :
111136 prompt = action .get ("prompt" , "Manual check required" )
112- from tests .test_scenarios import _prompt_yes_no
113- return _prompt_yes_no (prompt )
137+ return prompt_yes_no (prompt )
114138
115139 if action_type == "interactive" :
116140 # Prompt first, then call method (used for hold-button-and-read tests)
0 commit comments