mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-131677: Fix flaky test_lru_cache_threaded3 (gh-131679)
The call to `with self.subTest(...)` was not thread-safe.
This commit is contained in:
parent
7c3692fe27
commit
a123245986
1 changed files with 1 additions and 2 deletions
|
@ -1934,8 +1934,7 @@ class TestLRU:
|
||||||
time.sleep(.01)
|
time.sleep(.01)
|
||||||
return 3 * x
|
return 3 * x
|
||||||
def test(i, 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))
|
threads = [threading.Thread(target=test, args=(i, v))
|
||||||
for i, v in enumerate([1, 2, 2, 3, 2])]
|
for i, v in enumerate([1, 2, 2, 3, 2])]
|
||||||
with threading_helper.start_threads(threads):
|
with threading_helper.start_threads(threads):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue