Author vstinner
Recipients Nitapol, lukasz.langa, miss-islington, ned.deily, rhettinger, ronaldoussoren, rvijayak, vstinner
Date 2019-08-27.07:22:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566890560.75.0.660058883503.issue36205@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-08-27 07:22:40vstinnersetrecipients: + vstinner, rhettinger, ronaldoussoren, ned.deily, lukasz.langa, miss-islington, rvijayak, Nitapol
2019-08-27 07:22:40vstinnersetmessageid: <1566890560.75.0.660058883503.issue36205@roundup.psfhosted.org>
2019-08-27 07:22:40vstinnerlinkissue36205 messages
2019-08-27 07:22:39vstinnercreate