@@ -278,7 +278,7 @@ def _format_test_choice(test: DiscoveredTest, idx: int) -> str:
278278
279279
280280def _prompt_select_interactive (tests : list [DiscoveredTest ]) -> list [DiscoveredTest ]:
281- """Interactive selection with arrow keys using questionary."""
281+ """Interactive single selection with arrow keys using questionary (Enter selects highlighted) ."""
282282 try :
283283 import questionary
284284
@@ -289,35 +289,32 @@ def _prompt_select_interactive(tests: list[DiscoveredTest]) -> list[DiscoveredTe
289289 print (f"\n Found 1 test: { _format_test_choice (tests [0 ], 1 )} " )
290290 confirm = questionary .confirm ("Select this test?" , default = True , style = custom_style ).ask ()
291291 if confirm :
292- return tests
292+ return [ tests [ 0 ]]
293293 else :
294294 return []
295295
296- # Build checkbox choices
296+ # Build single-select choices
297297 choices = []
298298 for idx , t in enumerate (tests , 1 ):
299299 choice_text = _format_test_choice (t , idx )
300- choices .append (questionary .Choice (title = choice_text , value = idx - 1 , checked = False ))
300+ choices .append (questionary .Choice (title = choice_text , value = idx - 1 ))
301301
302302 print ()
303- selected_indices = questionary .checkbox (
304- "Select evaluation tests to upload :" ,
303+ selected_index = questionary .select (
304+ "Select an evaluation test :" ,
305305 choices = choices ,
306306 style = custom_style ,
307307 pointer = ">" ,
308- instruction = "(↑↓ move, space select, enter confirm)" ,
308+ instruction = "(↑↓ move, enter confirm)" ,
309309 ).ask ()
310310
311- if selected_indices is None : # Ctrl+C
311+ if selected_index is None : # Ctrl+C / Esc
312312 print ("\n Upload cancelled." )
313313 return []
314314
315- if not selected_indices :
316- return []
317-
318- selected_tests = [tests [i ] for i in selected_indices ]
319- print (f"\n ✓ Selected { len (selected_tests )} test(s)" )
320- return selected_tests
315+ chosen = tests [int (selected_index )]
316+ print ("\n ✓ Selected 1 test" )
317+ return [chosen ]
321318
322319 except ImportError :
323320 # Fallback to simpler implementation
@@ -372,9 +369,10 @@ def _prompt_select_fallback(tests: list[DiscoveredTest]) -> list[DiscoveredTest]
372369
373370
374371def _prompt_select (tests : list [DiscoveredTest ], non_interactive : bool ) -> list [DiscoveredTest ]:
375- """Prompt user to select tests to upload ."""
372+ """Prompt user to select exactly one test ."""
376373 if non_interactive :
377- return tests
374+ # In non-interactive mode, only proceed if unambiguous.
375+ return [tests [0 ]] if len (tests ) == 1 else []
378376
379377 return _prompt_select_interactive (tests )
380378
@@ -401,7 +399,16 @@ def _discover_and_select_tests(project_root: str, non_interactive: bool) -> Opti
401399 return None
402400
403401 if not selected_tests :
404- print ("No tests selected." )
402+ if non_interactive and len (tests ) > 1 :
403+ print ("Error: Multiple evaluation tests found in --yes (non-interactive) mode." )
404+ print (" Please pass --evaluator or --entry to disambiguate." )
405+ else :
406+ print ("No test selected." )
407+ return None
408+
409+ # Enforce single-select at the helper level.
410+ if len (selected_tests ) != 1 :
411+ print ("Error: Please select exactly one evaluation test." )
405412 return None
406413
407414 return selected_tests
0 commit comments