Title: IDLE: Fix tooltip Hovertiptest failure
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.9, Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: ZackerySpytz, miss-islington, taleinat, terry.reedy
Priority: normal Keywords: patch

Created on 2019-01-18 06:51 by terry.reedy, last changed 2019-09-03 05:45 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14926 closed ZackerySpytz, 2019-07-24 04:01
PR 15634 merged taleinat, 2019-09-01 07:26
PR 15657 merged miss-islington, 2019-09-03 05:17
PR 15658 merged miss-islington, 2019-09-03 05:17
Messages (9)
msg333946 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-01-18 06:51
In the buildbot testing for #35730, this test failed on X86 Windows 3.7 and passed on retest.  I did not check the green bots, so there could be other fail and pass results.

FAIL: test_showtip_on_mouse_enter_hover_delay (idlelib.idle_test.test_tooltip.HovertipTest)
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\idlelib\idle_test\", line 112, in test_showtip_on_mouse_enter_hover_delay
    self.assertFalse(tooltip.tipwindow and tooltip.tipwindow.winfo_viewable())
AssertionError: 1 is not false

We should at least look at this since it might someday fail twice in a row on 1 machine.
msg334064 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-01-19 16:41
This is due to the test using a 50ms delay on hover, and checking "immediately" after generating an "<Enter>" event that it hasn't triggered yet.  Note that this isn't actually "immediately": The Tk root's update() is called in between to simulate having a live Tk event loop.

On slow machines this could indeed fail due to the update() call taking a while.

I originally chose 50ms since it seemed like more than enough. Using a longer delay would make the test more robust, but would make testing unnecessarily slow on fast machines.

Perhaps we should look for a more general solution, such as multiplying all test time values by a scale factor depending on a machine's execution speed?  That would avoid such future errors in many tests, while keeping the tests faster on fast machines.

Otherwise let's just increase this to 100ms or 200ms.
msg348364 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-07-24 04:04
For what it's worth, I see this failure often when running the test suite. I have created a pull request to increase the delay.
msg348374 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-24 07:15
I had forgotten about this, but by coincidence, it occurred again today, on 'x86 Windows7 3.7' after PR-14919 was merged.  This may be the same machine as I might have left '7' off 'Windows' in the original report.

The 'windows timer' is used for time.sleep.  From various web articles, I read that its resolution varies from 10 to 25, defaults to 15.8 milleseconds in Win7 (this is the figure I knew years ago), and defaults to 35 microseconds in Win 10.  (Not exactly agreement.) time.sleep is hardly accurate for small fractions of a second delays, and delays may be much longer.  I believe that root.after does better.

Zachery, what OS and version do you have?
msg348976 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-08-04 08:55
Sorry for the delay. I'm using Lubuntu 19.04.
msg351060 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-09-03 05:17
New changeset 132acaba5a7f01373ca624b1a5975b190fe866f5 by Terry Jan Reedy (Tal Einat) in branch 'master':
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
msg351062 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-09-03 05:28
To decide whether I agree that a live delay test is needed would take time and energy currently better applied to other issues.  Since the 2nd PR reduces net test time, and should be at least as good in avoiding spurious failures, I am merging it now.  If I later take a new, more general look at when live tests are needed, that will be another issue.
msg351063 - (view) Author: miss-islington (miss-islington) Date: 2019-09-03 05:35
New changeset 48058050cee5f6600150392100c162f223b4317f by Miss Islington (bot) in branch '3.7':
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
msg351064 - (view) Author: miss-islington (miss-islington) Date: 2019-09-03 05:39
New changeset 1c18aec3bb7d59061742854d3204439a5274e201 by Miss Islington (bot) in branch '3.8':
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
Date User Action Args
2019-09-03 05:45:33terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-09-03 05:39:10miss-islingtonsetmessages: + msg351064
2019-09-03 05:35:22miss-islingtonsetnosy: + miss-islington
messages: + msg351063
2019-09-03 05:28:59terry.reedysetmessages: + msg351062
2019-09-03 05:17:53miss-islingtonsetpull_requests: + pull_request15325
2019-09-03 05:17:14miss-islingtonsetpull_requests: + pull_request15324
2019-09-03 05:17:03terry.reedysetmessages: + msg351060
2019-09-01 07:26:25taleinatsetpull_requests: + pull_request15302
2019-08-04 08:55:44ZackerySpytzsetmessages: + msg348976
2019-07-24 07:15:42terry.reedysetmessages: + msg348374
2019-07-24 04:04:02ZackerySpytzsetnosy: + ZackerySpytz

messages: + msg348364
versions: + Python 3.9
2019-07-24 04:01:15ZackerySpytzsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request14697
2019-03-20 16:35:11terry.reedysetassignee: terry.reedy
components: + IDLE
2019-01-19 16:41:54taleinatsetmessages: + msg334064
2019-01-18 06:51:07terry.reedycreate