From 0e3cdeeea81862382dc67119a7dbc3ea017a2720 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Fri, 23 Oct 2026 01:02:57 -0700 Subject: [PATCH] test(browser): name each thread in the slow-reset stacks Before Python 3.14 faulthandler prints thread ids only, so the report now lists which name each id belongs to. CI on 3.10 to 3.13 failed the unit test that looks for the blocked thread by name. --- tests/browser/slow_reset_watch.py | 8 +++++++- tests/test_browser_slow_reset_watch.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/browser/slow_reset_watch.py b/tests/browser/slow_reset_watch.py index d2c07009..a3f6a6c8 100644 --- a/tests/browser/slow_reset_watch.py +++ b/tests/browser/slow_reset_watch.py @@ -114,10 +114,16 @@ def thread_stacks() -> list[str]: Formatting sys._current_frames() showed a thread blocked in SQLite as idle (Python 3.14); faulthandler reports where each thread really is. """ + # Before Python 3.14 faulthandler prints ids only; name each id here. + names = [ + f"thread 0x{thread.ident:016x} is {thread.name}" + for thread in threading.enumerate() + if thread.ident is not None + ] with tempfile.TemporaryFile() as dump: faulthandler.dump_traceback(file=dump, all_threads=True) dump.seek(0) - return dump.read().decode("utf-8", "replace").splitlines() + return [*names, *dump.read().decode("utf-8", "replace").splitlines()] def executor_state(loop: asyncio.AbstractEventLoop) -> list[str]: diff --git a/tests/test_browser_slow_reset_watch.py b/tests/test_browser_slow_reset_watch.py index 9a5626b9..bb24c53b 100644 --- a/tests/test_browser_slow_reset_watch.py +++ b/tests/test_browser_slow_reset_watch.py @@ -71,7 +71,7 @@ class TestResetWatch(unittest.TestCase): text = "\n".join(report) self.assertIn("POST /__test__/reset still running after", text) self.assertIn("database: 1 connections", text) - self.assertIn("[held-up]", text) + self.assertIn(f"thread 0x{worker.ident:016x} is held-up", text) self.assertIn("in blocked_here", text) watch.record_call("seed", 0.25, 1.5)