8000 Made test_simultaneous_success_fail fail more consistently (I hope). · python/cpython@afb6abf · GitHub
[go: up one dir, main page]

Skip to content

Commit afb6abf

Browse files
Made test_simultaneous_success_fail fail more consistently (I hope).
1 parent 8270e69 commit afb6abf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_asyncio/test_staggered.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,17 @@ async def test_second_fail(self):
9999
async def test_simultaneous_success_fail(self):
100100
# There's a potential race condition here:
101101
# https://github.com/python/cpython/issues/86296
102-
for _ in range(50):
102+
# As with any race condition, it can be difficult to reproduce.
103+
# This test may not fail every time.
104+
for i in range(201):
105+
time_unit = 0.0001 * i
103106
winner_result, winner_idx, exceptions = await staggered_race(
104107
(
105-
self.get_waiting_coroutine_factory(0, 0.1, True),
106-
self.get_waiting_coroutine_factory(1, 0.05, False),
108+
self.get_waiting_coroutine_factory(0, time_unit*2, True),
109+
self.get_waiting_coroutine_factory(1, time_unit, False),
107110
self.get_waiting_coroutine_factory(2, 0.05, True)
108111
),
109-
0.05,
112+
time_unit,
110113
)
111114
self.assertEqual(winner_result, 0)
112115
self.assertEqual(winner_idx, 0)

0 commit comments

Comments
 (0)
0