STINNER Victor <[email protected]> added the comment:
On PR 12287, Ned Deily wrote:
> I still think it would be better to have a test for this case since the
> problem embarrassingly went undetected for quite some time. But I'll let some
> one else deal with it if they care to.
test_time already contains a functional test on time.process_time() to ensure
that sleep isn't included in process time:
def test_process_time(self):
# process_time() should not include time spend during a sleep
start = time.process_time()
time.sleep(0.100)
stop = time.process_time()
# use 20 ms because process_time() has usually a resolution of 15 ms
# on Windows
self.assertLess(stop - start, 0.020)
info = time.get_clock_info('process_time')
self.assertTrue(info.monotonic)
self.assertFalse(info.adjustable)
Writing tests on clocks is really hard, since every single platform has a
different resolution. Previous attempts to write "accurate" tests on clock
caused a lot of flaky tests making our CIs fail randomly. We removed some tests
because of that.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com