
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-06-06 02:57 byterry.reedy, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| macosx-contained.diff | terry.reedy,2016-06-06 22:02 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg267513 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-06-06 02:57 | |
Lib/idlelib/macosx.py:8 initializes _tk_type to None. It next defines private function _initializeTkVariantTests, which in called in setupApp and which initializes _tk_type. Then follow 4 isXyzTk functins, which "assert _tk_type is not None". This is fine for IDLE because IDLE call setupApp on startup.This is not fine for testing. In general, tests do not and should not call setupApp. If a test happens to exercise one of the 11 (for now) isXyzTk calls occurring outside of macosx, the assert is triggered. The test writer must then discover to import and call the supposedly private _initializeTkVariantTests.I would prefer instead that maxosx be more self-contained, and initialize _tk_type as needed. _initializeTkVariantTests needs a Tk instance for this line. ws = root.tk.call('tk', 'windowingsystem')I would like to wrap that with root = tkinter.Tk() and root.destroy. If that cannot be done on import, then instead of deleting the asserts, replace them with conditional calls to the initialization function. | |||
| msg267564 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-06-06 22:02 | |
Here is a post-import patch with tests. | |||
| msg267908 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-06-08 22:09 | |
New changesetcc7f63b6847e by Terry Jan Reedy in branch 'default':Issue#27239: idlelib.macosx.isXyzTk functions initialize as needed.https://hg.python.org/cpython/rev/cc7f63b6847e | |||
| msg267911 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-06-08 22:17 | |
I ran into this issue again with the test I am writing for another issue, so I pushed it as is, after testing.Ned, neither of the working OSX buildbots run gui tests. I am presuming that you run the test suite occasionally and will notice if test_idle fails.Serhiy, almost ditto, except for Zach Ware's Gentoo bot. What do you think of initializing, using a temporary Tk(), during import? Or best to leave as is? | |||
| msg268396 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2016-06-12 19:49 | |
New changesetd8a2b6efdd4a by Terry Jan Reedy in branch 'default':Issue#27239: Continue refactoring idlelib.macosx and adding macosx tests.https://hg.python.org/cpython/rev/d8a2b6efdd4a | |||
| msg268397 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2016-06-12 19:50 | |
Remove the now unneeded call in htest to _init_tk_type. It was tempting to leave the call for the 'efficiency' of the direct call with the available root, but there is a mental efficiency in removing it and making _init_tk_type completely an internal implementation detail of macosx.Remove the unneeded call in macosx.setupApp. This makes the _init_tk_type local to its section of the module. It also allows a test to set _tk_type to simulate being on a particular type of Mac and call setupApp without having the setting overwritten by the real value. Test_macosx now calls setupApp with each _tk_type set to each possible non-None value.The same objective could have been met by conditioning the call with 'if _tk_type is None:', but removing the call means that _init_tk_type is no longer ever called with a root, so the parameter can be removed and the function simplified. This section of macosx now takes care of initializing itself and the rest of IDLE can simply call the isTypeTk functions without worrying about initialization.Have macosx call its test when run as main. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:32 | admin | set | github: 71426 |
| 2019-03-21 18:18:46 | terry.reedy | set | nosy: -python-dev components: + IDLE |
| 2016-06-12 19:50:23 | terry.reedy | set | messages: +msg268397 |
| 2016-06-12 19:49:48 | python-dev | set | messages: +msg268396 |
| 2016-06-10 04:18:16 | terry.reedy | set | status: open -> closed stage: needs patch -> resolved |
| 2016-06-08 22:17:33 | terry.reedy | set | resolution: fixed messages: +msg267911 stage: patch review -> needs patch |
| 2016-06-08 22:09:44 | python-dev | set | nosy: +python-dev messages: +msg267908 |
| 2016-06-06 22:02:59 | terry.reedy | set | files: +macosx-contained.diff keywords: +patch messages: +msg267564 stage: test needed -> patch review |
| 2016-06-06 02:57:34 | terry.reedy | create | |