@@ -36,12 +36,17 @@ def iter_scenario_tests():
3636 with open (yaml_file , encoding = "utf-8" ) as f :
3737 scenario = yaml .safe_load (f )
3838
39- driver = scenario ["driver" ]
39+ is_board = scenario .get ("type" ) == "board"
40+ name = scenario .get ("name" , scenario .get ("driver" , yaml_file .stem ))
4041 for test in scenario .get ("tests" , []):
4142 modes = test .get ("mode" , ["mock" , "hardware" ])
43+ if is_board :
44+ # Board scenarios are hardware-only
45+ modes = [m for m in modes if m == "hardware" ]
4246 for mode in modes :
43- test_id = f"{ driver } /{ test ['name' ]} /{ mode } "
44- yield pytest .param (scenario , test , mode , id = test_id )
47+ test_id = f"{ name } /{ test ['name' ]} /{ mode } "
48+ marks = [pytest .mark .board ] if is_board else []
49+ yield pytest .param (scenario , test , mode , id = test_id , marks = marks )
4550
4651
4752def make_mock_instance (scenario ):
@@ -154,15 +159,18 @@ def test_scenario(scenario, test, mode, port):
154159 input (f" [INTERACTIVE] { pre_prompt } " )
155160 else :
156161 print (f" [INTERACTIVE] { pre_prompt } " )
157- result = bridge .run_script (
158- scenario ["driver" ],
159- scenario ["driver_class" ],
160- scenario ["i2c" ],
161- test ["script" ],
162- module_name = scenario .get ("module_name" ),
163- hardware_init = scenario .get ("hardware_init" ),
164- i2c_address = scenario .get ("i2c_address" ),
165- )
162+ if scenario .get ("type" ) == "board" :
163+ result = bridge .run_raw_script (test ["script" ])
164+ else :
165+ result = bridge .run_script (
166+ scenario ["driver" ],
167+ scenario ["driver_class" ],
168+ scenario ["i2c" ],
169+ test ["script" ],
170+ module_name = scenario .get ("module_name" ),
171+ hardware_init = scenario .get ("hardware_init" ),
172+ i2c_address = scenario .get ("i2c_address" ),
173+ )
166174 else :
167175 pytest .fail (f"Unknown action: { action } " )
168176
0 commit comments