@@ -57,7 +57,7 @@ def find_buttons(tree, results=None):
5757 return results
5858
5959
60- def run_tests (mpos , only = None ):
60+ def run_tests (mpos , only = None , is_serial = False ):
6161 sections = {
6262 "basic" : test_basic ,
6363 "ui" : test_ui_introspection ,
@@ -68,13 +68,13 @@ def run_tests(mpos, only=None):
6868 names = [s .strip () for s in only .split ("," )]
6969 for n in names :
7070 if n in sections :
71- sections [n ](mpos )
71+ sections [n ](mpos , is_serial = is_serial )
7272 else :
7373 for name , fn in sections .items ():
74- fn (mpos )
74+ fn (mpos , is_serial = is_serial )
7575
7676
77- def test_basic (mpos ):
77+ def test_basic (mpos , is_serial = False ):
7878 section ("Basic exec / eval / multiline" )
7979
8080 out = mpos .exec ("print('hello from mpos')" )
@@ -108,7 +108,7 @@ def test_basic(mpos):
108108 check (val == i * 10 , f"interleaved exec/eval { i } : x == { val } " )
109109
110110
111- def test_ui_introspection (mpos ):
111+ def test_ui_introspection (mpos , is_serial = False ):
112112 section ("UI creation / screenshot / widget tree / visible text" )
113113
114114 mpos .exec ("""
@@ -147,7 +147,7 @@ def test_ui_introspection(mpos):
147147 check (not mpos .find_text ("NonexistentXYZ12345" ), "find_text rejects nonexistent" )
148148
149149
150- def test_interaction (mpos ):
150+ def test_interaction (mpos , is_serial = False ):
151151 section ("Button interaction (press_key / press)" )
152152
153153 mpos .exec ("""
@@ -199,8 +199,11 @@ def cb(e):
199199 check ("clicked!" in texts , f"send_event fallback: { texts } " )
200200
201201
202- def test_multiple_sessions (mpos ):
202+ def test_multiple_sessions (mpos , is_serial = False ):
203203 section ("Multiple sessions" )
204+ if is_serial :
205+ check (True , "skipped (serial backend)" )
206+ return
204207 for i in range (3 ):
205208 with MPOSController () as m :
206209 out = m .exec ("print('session ' + str(42))" )
@@ -224,7 +227,7 @@ def main():
224227 ctrl = MPOSController (backend = "serial" , port = args .serial , baudrate = 115200 , reset = True )
225228 try :
226229 ctrl .start ()
227- run_tests (ctrl , only = args .only )
230+ run_tests (ctrl , only = args .only , is_serial = True )
228231 finally :
229232 ctrl .stop ()
230233 else :
0 commit comments