New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running test suites without gui but still having windows flash #72105
Comments
When I run test suites I find something interesting. Even if I don't enable gui resource there are still windows flashing. The two tests are test_idle and test_tk. I think the root cause is that they both use test.support.import_module with no reason and then root.update(in _is_gui_available) is called and windows flash. Comment out root.update windows are gone. Is this a must or can we find some way to suppress this? |
For your reference, the root.update is introduced in bpo-22770. |
The order of the checks in support.requires{,_resource} should be reversed: check if the resource is enabled, then check for gui availability if the resource in question is 'gui'. |
I tried that, no help to this thread, but I think that is better. root.update itself draws something on the screen. |
Ahh, sorry. I misunderstand your message. Just ignore my last one. Really sorry for making noise. Your suggestion makes sense I think. |
To my surprise, "python -m test test_idle" gives a single flash in Windows. bpo-22770 modified /Lib/test/support/init.py and added the creation and packing of a Label. Those two lines are gone in repository 3.6 but the flash is still there, I added root.withdraw() at line 469 and the flash is gone.
I added a Label packing back and the flash is still gone here.
|
Some time ago I tried adding 'root.withdraw' to idle_test files that used tkinter to stop the widget flashing. This never worked completely. Now I know why -- it was the test.support import. Knowing this now, I opened bpo-27922 to add 'root.withdraw' where else needed. With support.__init__ patched, idle tests in 3.6 are currently flash-free, with -ugui, and 2.7 and 3.5 should be also. So unless there is objection by tomorrow, I will patch all three versions. I want the import flash suppressed even when -ugui is passed. |
Sorry, this is a typo. I meant to say "they both use test.support.requires". There should be *no* "no reason" and it's "requires" not "import_module". Sorry to confuse you. Staying late in night fools my brain. I think it's nice to suppress the flash totally in support. Even gui is enabled a single support.requires may seem somewhat confusing to flash a window. Can we also apply Zachary's suggestion? If gui is not enable, there is no need to check _is_gui_available. |
I completely agree that we should not check that gui works unless and until it is requested. Can you write a patch to do the switch? My point was that even when I request gui, I still don't want to see the flash. I do TDD for test files as well as app files and I may run tests 10s of times in a day. I will be happy to have that be a bit less stressful. |
It's my pleasure.
I also mean that in my last message, in this sentence " Even gui is enabled a single support.requires may seem somewhat confusing to flash a window". But it seems my poor English doesn't make it clear. :( bpo-27918.patch does the switch and I add the withdrawn you suggest. |
Xiang’s second patch looks okay to me. The flashes occasionally annoy me with X windows if I am doing something else and have the Python tests running in the background. I understand deferring the _is_gui_available() call will fix the main problem, and the withdraw() call is just an added nicety to avoid unnecessary windows when you actually enable -ugui. |
New changeset de9e410e78d8 by Terry Jan Reedy in branch '2.7': New changeset 756c27efe193 by Terry Jan Reedy in branch '3.5': |
This issue only addresses and fixes the 1 flash per process from test.support.is_gui_available. I separately added root.withdraw to IDLE tests in bpo-27922, to stop their flashes. Doing the same for tkinter tests would be a third issue. I believe it would be easy since tkinter has a support module with mechanisms to set up and tear down root windows. (I am thinking of something similar for IDLE.) I leave this to Serhiy. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: