From 238f68dd9a7fbe287023150c50d636474052766c Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Mon, 24 Mar 2025 16:00:06 +0000 Subject: [PATCH] gh-131677: Fix flaky test_lru_cache_threaded3 The call to `with self.subTest(...)` was not thread-safe. --- Lib/test/test_functools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 0bbfcfd0369cf3..2b49615178f136 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1934,8 +1934,7 @@ def f(x): time.sleep(.01) return 3 * x def test(i, x): - with self.subTest(thread=i): - self.assertEqual(f(x), 3 * x, i) + self.assertEqual(f(x), 3 * x, i) threads = [threading.Thread(target=test, args=(i, v)) for i, v in enumerate([1, 2, 2, 3, 2])] with threading_helper.start_threads(threads):