◐ Shell
reader mode source ↗
Skip to content

gh-75710: IDLE: Add tests to some editor.py functions#3669

Open
csabella wants to merge 15 commits into
python:mainfrom
csabella:binding_tests
Open

gh-75710: IDLE: Add tests to some editor.py functions#3669
csabella wants to merge 15 commits into
python:mainfrom
csabella:binding_tests

Conversation

@csabella

@csabella csabella commented Sep 20, 2017

Copy link
Copy Markdown
Contributor

Add docstrings and test for editor.py functions related to the reload from configdialog, creating the menubar, and applying keybindings.

https://bugs.python.org/issue31529

@csabella

csabella commented Sep 20, 2017

Copy link
Copy Markdown
Contributor Author

I was trying to understand the editor functions accessed from configdialog so that I could test those and thought the best way to understand what was really happening was to document and test the functions being called.

Some notes:

  1. I haven't done ResetColorizer because that seemed like its own rabbithole.
  2. I had to add a windows-only test because os.startfile is a windows only function and wouldn't work on my system. Hope it works.
  3. I was getting the timer_event CodeContext errors when running the tests, so I added a line to _close() in editor.py to unbind that event before deleting the text instance and it made the error go away. If it's the right fix, you may want to pull that out into its own PR.

Sorry that this is still massive. I really tried to limit it to what I needed to look at.

@taleinat taleinat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

Amazing work adding so many tests for the editor window! I think these are sorely needed, and it's too bad they've been languishing here for a while now.

I've got a bunch of review comments, but overall this is a huge improvement, and I'd like to help get it through!

@taleinat

Copy link
Copy Markdown
Contributor

Ping, @csabella?

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

I am going to first edit the new docstrings as indicated in my reponses to Tal's comments, and make a separate PR.

3 hidden conversations Load more…
@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@terryjreedy

Copy link
Copy Markdown
Member

Whoops, by responding to Tal's comments as part of a new review, my responses got listed twice, once under Tal's comment where they below and then again separately, without the context.

@terryjreedy

Copy link
Copy Markdown
Member

I minimally resolved the merge conflict in the web box so I could proceed. This did a full merge update rather than just updating the one file. There is still the redundancy of global requires gui and class requires gui to be fixed, and Tal's other conflicts. Since I had to do this, I will go ahead and edit everything on this PR.

@terryjreedy

terryjreedy commented Sep 21, 2020

Copy link
Copy Markdown
Member

I stopped the Windows test failures by commenting out the failing lines with an explanation.

The Ubuntu failure is

  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/idlelib/idle_test/test_editor.py", line 422, in test__extra_help_callback_not_windows
    ehc = partial(w._EditorWindow__extra_help_callback, w)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
AttributeError: Mock object has no attribute '_EditorWindow__extra_help_callback'. Did you mean: '_EditorWindow__recent_file_callback'?

May do the same here.

@terryjreedy

Copy link
Copy Markdown
Member

I think editor.py is more or less commit ready. Tal, review again or not as you wish.

Test_editor is not ready. test_editor passes, but still needs requires('gui') restricted. I want to try Tal's suggested alternative. And also make sure that every test is actually testing. The test I revised was not, as the function supposedly being tested was mocked.

test_mainmenu passes by itself, but test_idle fails with

File "f:\dev\3x\lib\idlelib\idle_test\test_mainmenu.py", line 17, in test_default_keydefs
self.assertGreaterEqual(len(mainmenu.default_keydefs), 50)
AssertionError: 5 not greater than or equal to 50

5 happens to be the length of keydefs used in test_editor, which run first, so the test change is somehow affecting mainmenu. This is probably via changing something in config. test_editor does not import config, but editor does.

@terryjreedy

Copy link
Copy Markdown
Member

Additional test failure: Windows error box titled "Document Start Failure" with message "(X) boom". Test freezes until box is dismissed. I suspect a test of additional help resources needs mocks for both Windows and *nix.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 23, 2022
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jul 29, 2022
8 hidden items Load more…
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 1, 2022
@hauntsaninja hauntsaninja changed the title bpo-31529: IDLE: Add docstrings and tests to some editor.py functions Jan 7, 2023
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jan 8, 2023
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 7, 2023
@python python deleted a comment from github-actions Bot May 13, 2023
@python python deleted a comment from github-actions Bot May 13, 2023
@python python deleted a comment from github-actions Bot May 13, 2023
terryjreedy added a commit to terryjreedy/cpython that referenced this pull request May 13, 2023
Commit extracted from PR python#3669.  Will edits more later.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
terryjreedy added a commit that referenced this pull request May 13, 2023
Commit extracted from PR #3669.  Will edit more later.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 13, 2023
…ythonGH-104446)

Commit extracted from PR pythonGH-3669.  Will edit more later.

(cherry picked from commit 46f1c78)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
terryjreedy added a commit that referenced this pull request May 13, 2023
…H-104446) (#104450)

gh-75710: IDLE - add docstrings and comments to editor module (GH-104446)

Commit extracted from PR GH-3669.  Will edit more later.

(cherry picked from commit 46f1c78)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 14, 2023
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 14, 2023
@hugovk hugovk changed the title gh-75710: IDLE: Add docstrings and tests to some editor.py functions Jan 9, 2025
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jan 9, 2025
@github-actions

github-actions Bot commented Feb 8, 2025

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants