Skip to content

IDLE: add tests for help_about.py #74476

Open

Description

@terryjreedy
BPO 30290
Nosy @terryjreedy, @mlouielu, @csabella
PRs
  • bpo-30290: IDLE: Add test for help_about dialog #1697
  • bpo-30290: IDLE: Refactor help_about to PEP8 names #1714
  • bpo-30290: IDLE test_help_about: edit and add test. #1838
  • [3.6] bpo-30290: IDLE - pep8 names and tests for help-about  #2068
  • [3.6] bpo-30290: IDLE - pep8 names and tests for help-about #2070
  • Dependencies
  • bpo-30303: IDLE: Add _utest to textview and add textview tests
  • 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:

    assignee = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2017-05-06.05:03:19.798>
    labels = ['expert-IDLE', 'type-feature', '3.7']
    title = 'IDLE: add tests for help_about.py'
    updated_at = <Date 2019-01-17.22:28:53.730>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-01-17.22:28:53.730>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2017-05-06.05:03:19.798>
    creator = 'terry.reedy'
    dependencies = ['30303']
    files = []
    hgrepos = []
    issue_num = 30290
    keywords = []
    message_count = 24.0
    messages = ['293152', '293998', '294004', '294058', '294064', '294079', '294082', '294092', '294094', '294095', '294100', '294114', '294115', '294121', '294139', '294298', '294347', '294608', '294616', '294620', '294625', '295302', '295615', '333903']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'louielu', 'cheryl.sabella']
    pr_nums = ['1697', '1714', '1838', '2068', '2070']
    priority = 'normal'
    resolution = None
    stage = 'commit review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue30290'
    versions = ['Python 3.6', 'Python 3.7']

    Activity

    1. terryjreedy commented on May 6, 2017

      @terryjreedy
      MemberAuthor

      Initial plan.
      1a. Change AboutDialog to mimic query.Query with respect to _utest and suppression of dialog display and waiting.
      1b. Create AboutDialog instance.
      2a. Change textview.TextViewer as with AboutDialog. Also change textview functions and AboutDialog methods to pass on _utest.
      2b. Simulate keyclicks on buttons and test that root gains appropriate child. Then destroy it.
      3. At some point, remove dead code and change now incorrect encoding comment.

      Separate issue: add simulated button click tests to test_textview and other popup dialogs. Directly calling commands does not test that buttons invoke the right command.

    2. self-assigned this
      on May 6, 2017
    3. terryjreedy commented on May 20, 2017

      @terryjreedy
      MemberAuthor

      4a. Change uglyMidcap widget names and CamelCase function names to pep8_conformant names. Simplify: byline, email, docs, pyver, tkver, idlever, py_license, py_copyright, py_credits, readme, idle_news, idle_credits.

      4b. Change CamelCase function names to pep8_conformant names.
      ShowIDLEAbout => show_readme,

      1. Add docstrings
        For show_xyz functions, "Command for xyz button"? even though not verb?

      bpo-30303 implemented 2a, improve textview and tests.

      Cheryl: this should be much easier than colorizer. Let me know if you want to take a stab at at least 4 and 5.

    4. terryjreedy commented on May 20, 2017

      @terryjreedy
      MemberAuthor

      Follow-up issues.

      A. Move code and tests into help.py and test_help.py.
      B. Improve content: 1) bpo-25224; 2) remove or update credits;
      3) reconsider each item.
      C. Improve appearance: 1) ttk widgets; 2) Redo entire look.

    5. csabella commented on May 20, 2017

      @csabella
      Contributor

      This looks like fun! :-) I'll let you know if I have any questions.

    6. csabella commented on May 21, 2017

      @csabella
      Contributor

      Terry,

      Is there interest in changing the 'from tkinter import *'?

    7. terryjreedy commented on May 21, 2017

      @terryjreedy
      MemberAuthor

      I take 'fun' to mean you will try something. And yes, I have thought about the following for all IDLE modules.

      1. Replace "from tkinter import *". It was mainly intended for interactive use. In production IDLE, use either
        a. from tkinter import Tk, Frame, Label, Button, <constants>
        b. import tkinter as tk

      6a requires more typing in the import statement, but as a replacement, leaves the rest of the code alone. It documents what widgets will be used in the module. It allows individual classes to be mocked for a particular test or group of tests. I know I have done this for the tkinter TypeVar classes.

      6b has a short import but requires more typing in the module body, especially when tkinter constants are present, as they are here.

      When exploring or writing short, one-off programs, I usually use 'as tk'. But for IDLE, I may have converted at least one file to 'as tk', but I am now using 'import Tk, ...' and prefer it.

      My current thoughts about Tkinter constants versus string literals, such as BOTH versus 'both': The two forms by themselves are about equally easy to type. The CAPS form is shorter but louder, whereas to me they are minor items that should not be loud. The constants seem designed to work with 'import *'; one can then potentially use name completion for the longer names. After 'as tk', I think "tk.Both" is worse than "'both'". For new code with explicit imports, adding constants to the imports is extra work. For existing code with many constants, such as help_about, adding constants to the imports is less work than converting. So I am inclined to leave them as are until such time as we might do a search-replace throughout idlelib.

      When there are a few constants, I have put them after the classes. For this module, I would like to try a separate import rather than use '\' line continuation.

      from tkinter import TOP, BOTTOM, SIDE, SUNKEN, EW, ...

      In one file with just two constants, I initially converted to the quoted literal, but another core dev objected on the basis that the constants are checked when the function is compiled instead of when called, and that this is somehow safer. For when issue comes up again, I am recording my current replies here.

      1. The same logic would suggest that we should write, for instance, "open(filename, mode=W, encoding=ASCII, errors=STRICT)" (after appropriate imports) instead of the current "open(filename, mode='w', encoding='ascii', errors='strict')".

      2. If running a file to do a test compile also does a test call of create-widget functions, then the objection does not apply. For every IDLE file that creates tk windows, there is an htest, initiated by running the file, that creates an instance of the window. The first purpose is to insure that widget creation calls are legitimate. The unit tests will eventually do the same, as in 1b above. (The second purpose, not duplicated by unittests, is to see if the result 'looks good'.)

    8. mlouielu commented on May 21, 2017

      mlouielumannequin
      Mannequin

      Due to the merged of bpo-30303, text_view now have _utest attribute for unittest, upload the unittest of help_about dialog in PR 1697

    9. terryjreedy commented on May 21, 2017

      @terryjreedy
      MemberAuthor

      Louie, at first glance, this appears to implement the remaining changes in 1 and 2.

      A possible problem is that I expect the needed 'self.' additions will conflict with the name changes on the same lines that Cheryl said she would do, about 10 hours ago. Cheryl, if you have not yet started your patch, hold off for now, until I can properly review Louie's patch.

    10. csabella commented on May 21, 2017

      @csabella
      Contributor

      Oh, I had started to make the changes, but that's OK. I'm still doing discovery too. 'Fun' did mean that I'll try something. This is exactly what I wanted to work on to dive into tkinter and idle, so I got excited.

      Louie, just to coordinate, are you working on other items that Terry listed here?

      Terry, should I do each item in its own PR for quick review or should I try to do many at once in a single PR? I was doing both the name changes and docstrings (and now maybe the import change) in one PR, but maybe that's too much?

    11. mlouielu commented on May 21, 2017

      mlouielumannequin
      Mannequin

      Cheryl: yes, I may work on 4a/4b and msg294004 on Monday, or do you start at these tasks?

    12. terryjreedy commented on May 21, 2017

      @terryjreedy
      MemberAuthor

      I am about to go to bed, way late.

      I would like to review and apply all the non-test changes, 4,5,6 in one PR, and add 3 since I know what I meant. There can be multiple commits in one PR though.

      Louie, from bpo-30422 and a tracker search, you can see that there is lots to do, for more that 1 or even 2 people. I think 4,5,6 are a good way for Cheryl to start with IDLE. Other files need similar changes that do not need your tkinter skills.

      If you are looking for a useful challenge, there are 12 open IDLE debugger issues + some enhancements debugger ideas I have not bothered to post yet. If that does not interest you, I can try to suggest something else after I get up again.

      I expect to be away from my computer on my Monday.

    13. 7 remaining items

    14. terryjreedy commented on May 27, 2017

      @terryjreedy
      MemberAuthor

      While reviewing, I decided to draw a widget tree. I believe it would have been easier if packs and grids were grouped.

      I want to continue with 'IDLE: modernize help-about' and ditto for textview. The help_about issue can begin with ttk conversion: change imports and remove an invalid option or two. The textview issue can begin with the still missing docstrings. I want to refactor both the way I discussed in the roadmap issue: make separate Toplevel and Frame subclasses. The Toplevel subclass instance creates a Frame subclass instance which becomes an attribute of the toplevel. Help.py already has this structure.

    15. csabella commented on May 28, 2017

      @csabella
      Contributor

      Thanks Terry. I've submitted a PR for the textview docstrings and PEP-8 names and I'll work on the ttk conversion and the refactoring.

    16. terryjreedy commented on May 28, 2017

      @terryjreedy
      MemberAuthor

      pr 1839 is now attached to new issue bpo-30495. This issue is closed except for trivial bugs in the two merged PRs and backports.

    17. terryjreedy commented on Jun 6, 2017

      @terryjreedy
      MemberAuthor

      A follow-up to my brief remarks about revamping About IDLE, in msg294298: idle-dev is subscription-required public forum for discussion of idle design issues. It has been dormant for a year and a half, but I would like to revive it to get broader user input. By coincidence, the first new post (held since April because the author is not subscribed) is a suggestion for AboutIDLE. In my second response, I listed 9 possible or definite changes. I would like that to be where we plan a future 'Modernize About IDLE' issue.

    18. terryjreedy commented on Jun 10, 2017

      @terryjreedy
      MemberAuthor

      New changeset 12cbd87 by terryjreedy in branch '3.6':
      [3.6] bpo-30290: IDLE - PEP-8 names and tests for help-about (bpo-2070)
      12cbd87

    19. terryjreedy commented on Jan 17, 2019

      @terryjreedy
      MemberAuthor

      Postscript: this test that the retrieved text has at least two lines caught a bug in the new Windows Store python distribution.

          self.assertEqual(printer._Printer__lines[1],
                           dialog._current_textview.textView.get('2.0', '2.end'))

      The license file was missing and the backup default had only one line.
      bpo-35683, msg333891

    20. transferred this issue fromon Apr 10, 2022
    21. added
      pendingThe issue will be closed if no feedback is provided
      on Jul 25, 2022
    22. terryjreedy commented on Jul 25, 2022

      @terryjreedy
      MemberAuthor

      This became a meta-issue, which was awkward on bpo because of not being able to edit the todo list and add completion checkmarks and the issue in-place. I need to review this and other IDLE tracking/meta-issues and replace with up-to-date GH task lists. (Link is for me.)

    23. removed
      pendingThe issue will be closed if no feedback is provided
      on Jul 25, 2022
    24. moved this to In Progress in IDLE Issueson Jul 27, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    testsTests in the Lib/test dirtopic-IDLEtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions