From 1fba0be359cfbf2a04f194a31fc7b07de1ad8b6f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 25 May 2026 19:17:00 +0100 Subject: [PATCH] gh-150387: Fix hang in test_run_failed_script_live on slow buildbots (GH-150405) (cherry picked from commit 3cf6ef445fa3c5b942edaa9d9c47848bdf82e3d9) Co-authored-by: Pablo Galindo Salgado --- .../test_sampling_profiler/test_live_collector_ui.py | 3 +-- .../Tests/2026-05-25-15-39-53.gh-issue-150387.yzZ7jq.rst | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2026-05-25-15-39-53.gh-issue-150387.yzZ7jq.rst diff --git a/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py b/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py index c0d39f487c8cbd..59373a8d00c03c 100644 --- a/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py +++ b/Lib/test/test_profiling/test_sampling_profiler/test_live_collector_ui.py @@ -835,8 +835,7 @@ def mock_init_curses_side_effect(self, n_times, mock_self, stdscr): # still failing for _ in range(n_times): mock_self.display.simulate_input(-1) - if n_times >= 500: - mock_self.display.simulate_input(ord('q')) + mock_self.display.simulate_input(ord('q')) def test_run_failed_module_live(self): """Test that running a existing module that fails exits with clean error.""" diff --git a/Misc/NEWS.d/next/Tests/2026-05-25-15-39-53.gh-issue-150387.yzZ7jq.rst b/Misc/NEWS.d/next/Tests/2026-05-25-15-39-53.gh-issue-150387.yzZ7jq.rst new file mode 100644 index 00000000000000..663a357a179204 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-05-25-15-39-53.gh-issue-150387.yzZ7jq.rst @@ -0,0 +1,5 @@ +Fix hang in +``test.test_profiling.test_sampling_profiler.test_live_collector_ui.TestLiveModeErrors.test_run_failed_script_live`` +on slow buildbots. The test now always queues a final ``q`` keystroke so the +live TUI loop exits even when the profiler collects enough samples to enter +the post-finished input loop.