8000 Make test_sleep_until a little more tolerant · python/cpython@8af29db · GitHub
[go: up one dir, main page]

Skip to content

Commit 8af29db

Browse files
committed
Make test_sleep_until a little more tolerant
1 parent dc1824b commit 8af29db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_time.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ def test_sleep_until(self):
164164
deadline = start + 2
165165
time.sleep_until(deadline)
166166
stop = time.time()
167-
self.assertLess(abs(stop - deadline), 0.050)
167+
delta = stop - deadline
168+
# cargo-cult these 50ms from test_monotonic (bpo-20101)
169+
self.assertGreater(delta, -0.050)
170+
# allow sleep_until to take up to 1s longer than planned
171+
# (e.g. in case the system is under heavy load during testing)
172+
self.assertLess(delta, 1.000)
168173

169174
def test_epoch(self):
170175
# bpo-43869: Make sure that Python use the same Epoch on all platforms:

0 commit comments

Comments
 (0)
0