bpo-30617: IDLE: docstrings and unittest for outwin.py#2046
Conversation
|
@csabella, thanks for your PR! By analyzing the history of the files in this pull request, we identified @kbkaiser, @rhettinger and @terryjreedy to be potential reviewers. |
Sorry, something went wrong.
mlouielu
left a comment
There was a problem hiding this comment.
IMO, if we are trying to add docstring or unittest, we should only add docstring and unittest, and not need to move other code, for example, the _file_line_helper and others.
Otherwise, it will be a refactor, and should be mention in the commit message (and title). If the refactoring is a must, I will prefer to split it into to two PR.
And the string quote should be consist. If we choice to use ', it will all be ' in the new code.
Sorry, something went wrong.
|
@mlouielu I haven't made a separate PR yet, but I've made the other changes you suggested. I also added deletes for the mocks. One thing I wanted to ask is if you could help with the errors I'm getting when running the tests (warning: callback failed in WindowList <class '_tkinter.TclError'> : invalid command name ".!menu.windows"). I don't know enough to understand where to look to figure this out or what to change. Would you have any suggestions on what I can look at or how I can trace it? Thanks! |
Sorry, something went wrong.
2f964a4 to
4adf076
Compare
July 21, 2017 12:46
terryjreedy
left a comment
There was a problem hiding this comment.
The major issue is the test failure when the entire suite is run, which I will discuss separately.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Sorry, something went wrong.
The problem in not with the messagebox import in outwin.py, as it persists with the import disabled. (This causes a later error when the above does not occur.) The test passes with line 269 commented out. Line 271
I believe that the problem is that we twice mocked askyesno in test_configdialog by replacing it and then deleting it. It is the same error as I reported above for showerrer here. The fix should save and restore. It can be a short PR for bpo-30780. Added: I opened new issue bpo-31287. I fixed issue by localizing askyesno to classes and then masking with instance attribute in tests. Did same for outwin and showerror. |
Sorry, something went wrong.
|
News blurb also needed |
Sorry, something went wrong.
|
The update includes the fix from bpo-31287 that fixes the GUI test failure (no messagebox.askyesno). I added a new file. Unfortunately, it causes Appveyor to not run. Closing and opening did not either. A regular patch will trigger Appveyor. Unless you post a patch first, I am going to make the fairly simple changes I requested. |
Sorry, something went wrong.
|
Sorry, I was trying to figure out the whole thing with why Thanks for making the other changes. |
Sorry, something went wrong.
|
The configdialog test replaced the original askyesno function in the messagebox module with a Mock and then deleted the mock. Some test imported editor before that, and editor imported the same module object. By the time outwin imported editor, the messagebox module referenced by editor was deficient. Test_idle is run in one process. What puzzled me is that when outwin imported messagebox, it was not the same module object. (It had a different id().) I did not try to work out why. Python imports, with caching in sys.modules, is a tricky business sometimes. |
Sorry, something went wrong.
|
Thanks for explaining. I played around some more (using mock.patch) and I think I have a better understanding of this. There's a line in the mock.patch documentation, under the |
Sorry, something went wrong.
Move some data and functions from the class to module level. Patch by Cheryl Sabella.
https://bugs.python.org/issue30617