This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients miss-islington, pitrou, vstinner
Date 2018-11-28.17:03:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1543424639.14.0.788709270274.issue33723@psf.upfronthosting.co.za>
In-reply-to
Content
A test failed again on AppVeyor! In the 3.7 branch, on this test:

def busy_wait(duration):
    deadline = time.monotonic() + duration
    while time.monotonic() < deadline:
        pass
(...)
    def test_thread_time(self):
        (...)
        # bpo-33723: A busy loop of 100 ms should increase thread_time()
        # by at least 15 ms, but less than 30 ms in other threads.
        # Tolerate 15 and 30 ms because of the bad resolution
        # of the clock on Windows (around 15.6 ms).
        min_time = 0.015
        max_time = 0.030
        busy_time = 0.100

        # thread_time() should include CPU time spent in current thread...
        start = time.thread_time()
        busy_wait(busy_time)
        stop = time.thread_time()
        self.assertGreaterEqual(stop - start, min_time)   # <===== HERE =====
        (...)

FAIL: test_thread_time (test.test_time.TimeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_time.py", line 550, in test_thread_time
    self.assertGreaterEqual(stop - start, min_time)
AssertionError: 0.0 not greater than or equal to 0.015

IMHO the root issue is that time.thread_time() and time.monotonic() clocks are just... unrelated... on Windows.

This time, I give up and wrote a PR to remove the "busy loop" tests, sorry! PR 10773.
History
Date User Action Args
2018-11-28 17:03:59vstinnersetrecipients: + vstinner, pitrou, miss-islington
2018-11-28 17:03:59vstinnersetmessageid: <1543424639.14.0.788709270274.issue33723@psf.upfronthosting.co.za>
2018-11-28 17:03:59vstinnerlinkissue33723 messages
2018-11-28 17:03:59vstinnercreate