From 0a238e009ba03f56c7cc548b6508dd493dc981cc Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 5 Nov 2026 16:47:34 +0000 Subject: [PATCH] tests: Start thread only after registering cleanups and registering thread Not that this matters. --- tests/metrics/test_thread_cpu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/metrics/test_thread_cpu.py b/tests/metrics/test_thread_cpu.py index a35f8550a5..4246cc11ba 100644 --- a/tests/metrics/test_thread_cpu.py +++ b/tests/metrics/test_thread_cpu.py @@ -90,7 +90,6 @@ class ThreadCPUMetricsTestCase(unittest.TestCase): # Note that the thread name only gets passed to the kernel from Python # 3.14 onwards. thread = threading.Thread(target=run_on_thread, name="a) b) (c") - thread.start() # Cleanup functions are run in reverse order, so first we set the # release event (to wake the thread up), and then we wait for it exit. @@ -99,6 +98,8 @@ class ThreadCPUMetricsTestCase(unittest.TestCase): metrics.register_thread("test-thread", thread) + thread.start() + # Wait for the separate thread to burn CPU before continuing. self.assertTrue(burnt.wait(timeout=Duration(seconds=10).as_secs()))