classification
Title: test_time: test_monotonic() failed on AMD64 FreeBSD 10-STABLE Non-Debug 3.7
Type: Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: koobs, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2019-03-28 01:54 by vstinner, last changed 2019-04-24 10:51 by koobs. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12929 merged vstinner, 2019-04-23 15:48
PR 12930 merged miss-islington, 2019-04-23 22:15
Messages (3)
msg339002 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-28 01:54
AMD64 FreeBSD 10-STABLE Non-Debug 3.7:
https://buildbot.python.org/all/#/builders/170/builds/354

======================================================================
FAIL: test_monotonic (test.test_time.TimeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/test_time.py", line 474, in test_monotonic
    self.assertTrue(0.45 <= dt <= 1.0, dt)
AssertionError: False is not true : 1.0372954378835857

Extract of the test:

    def test_monotonic(self):
        ...

        # monotonic() includes time elapsed during a sleep
        t1 = time.monotonic()
        time.sleep(0.5)
        t2 = time.monotonic()
        dt = t2 - t1
        self.assertGreater(t2, t1)
        # Issue #20101: On some Windows machines, dt may be slightly low
        self.assertTrue(0.45 <= dt <= 1.0, dt)

        ...

IMHO the test is too strict. It should not test the maximum value of dt, only the minimum.
msg340744 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-23 22:15
New changeset d246a6766b9d8cc625112906299c4cb019944300 by Victor Stinner in branch 'master':
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
https://github.com/python/cpython/commit/d246a6766b9d8cc625112906299c4cb019944300
msg340745 - (view) Author: miss-islington (miss-islington) Date: 2019-04-23 22:35
New changeset e1a6cf2824acb43dc80473e0d938db99856daa97 by Miss Islington (bot) in branch '3.7':
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
https://github.com/python/cpython/commit/e1a6cf2824acb43dc80473e0d938db99856daa97
History
Date User Action Args
2019-04-24 10:51:29koobssetnosy: + koobs
2019-04-23 23:46:23vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-04-23 22:35:59miss-islingtonsetnosy: + miss-islington
messages: + msg340745
2019-04-23 22:15:33vstinnersetmessages: + msg340744
2019-04-23 22:15:30miss-islingtonsetpull_requests: + pull_request12855
2019-04-23 15:48:50vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request12854
2019-03-28 01:54:53vstinnercreate