diff --git a/tests/tools/test_transcription_tools.py b/tests/tools/test_transcription_tools.py index e9d7b50b32..3efd0b7efe 100644 --- a/tests/tools/test_transcription_tools.py +++ b/tests/tools/test_transcription_tools.py @@ -1203,12 +1203,19 @@ class TestRunCommandSttIdleTimeout: from tools.transcription_command import _run_command_stt script = tmp_path / "progress_then_exit.py" + # First tick is emitted immediately and the rest every 50ms — the + # total runtime (~400ms) exceeds the 250ms idle window, so passing + # depends on the progress extension. The immediate first tick also + # keeps the test honest on Windows, where process spawn alone can + # exceed a tiny idle window and previously raised TimeoutExpired + # before the first chunk was ever read (with all child output intact). script.write_text( "\n".join([ "import sys, time", - "for idx in range(4):", + "print('tick 0', file=sys.stderr, flush=True)", + "for idx in range(1, 9):", + " time.sleep(0.05)", " print(f'tick {idx}', file=sys.stderr, flush=True)", - " time.sleep(0.04)", "print('done', flush=True)", ]), encoding="utf-8", @@ -1216,11 +1223,11 @@ class TestRunCommandSttIdleTimeout: result = _run_command_stt( self._shell_command(sys.executable, "-u", str(script)), - timeout=0.1, + timeout=0.25, ) assert result.returncode == 0 - assert "tick 3" in result.stderr + assert "tick 8" in result.stderr assert "done" in result.stdout def test_silent_stall_still_times_out(self, tmp_path):