From e8e5b5db79bad120fbfc303392157266c17f3bbc Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Mon, 24 Mar 2025 16:41:50 -0400 Subject: [PATCH] gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679) The call to `with self.subTest(...)` was not thread-safe. (cherry picked from commit a1232459860235f4fb7896cc95966d87a51cbe32) Co-authored-by: Sam Gross --- 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 873170116f43cf..cd7b8aac42c5e1 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1756,8 +1756,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):