mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
[3.13] gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679) (gh-131692)
The call to `with self.subTest(...)` was not thread-safe.
(cherry picked from commit a123245986
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
3492098418
commit
c22eef44d8
1 changed files with 1 additions and 2 deletions
|
@ -1782,8 +1782,7 @@ class TestLRU:
|
|||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue