GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-95069: Move Lib/idlelib/idle_test/ to Lib/test/test_idle/ by vstinner · Pull Request #94145 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 22, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Move Lib/idlelib/idle_test/ to Lib/test/test_idle/
  • Remove Lib/test/test_idle.py
  • test_idle: Replace idlelib.idle_test with test.test_idle
  • idlelib: Replace idlelib.idle_test with test.test_idle
  • README.txt: Replace idle_test with test_idle
  • Update references
  • Update build sytem
  • Add test_idle.main sub-module
  • Update tests
  • Issue: Move test sub-packages to Lib/test #54781
  • Issue: Move test sub-packages to Lib/test #54781
  • Issue: IDLE: Move unittests to test directory #95069

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added the awaiting core review label Jun 22, 2022
@vstinner

vstinner commented Jun 22, 2022

Copy link
Copy Markdown
Member Author

@terryjreedy asked to not move IDLE tests:

  • Move test sub-packages to Lib/test #54781 (comment)
  • Move test sub-packages to Lib/test #54781 (comment)

I would prefer to not have IDLE as a special case and have all tests in Lib/test/. But @terryjreedy is the IDLE maintainer, and so I will follow his decision :-)

I created a PR to see in practice the consequences of moving Lib/idlelib/idle_test/ to Lib/test/test_idle/.

IMO such PR should not be backported since it has an impact on Linux distributions which put Lib/idlelib/idle_test/ in a separated "test" package, separated from the "python" package, to keep the "python" package smaller. At least, Fedora does that for "python3-test".

If the PR is not backported, we rely on Git to detect renamed/moved files to automate backports. In my experience, Git is quite good at that. We move files often, and Git always smoothly finds the old files and automatically patchs the correct file on backport.

If I understood correctly, IDLE is developed as an application separated from Python, but its code lives in Python Lib/idlelib/ directory. The code is the same, or almost the same, in 3.10, 3.11 and main branches. So I'm not sure how to deal with the minor different introduced by this PR. For example, 'idlelib.idle_test.test_help' is replaced with 'test.test_idle.test_help' in Lib/idlelib/help.py:

$ tail Lib/idlelib/help.py

if __name__ == '__main__':
    from unittest import main
    main('test.test_idle.test_help', verbosity=2, exit=False)

    from test.test_idle.htest import run
    run(show_idlehelp)

asyncio was developed as a third-party project (named "tulip") and distributed on PyPI. I recall that it was painful to synchronize the code between the 3rd party project and all supported branches in Python. So well, I'm not sure why should be done with IDLE. It's up to you Terry ;-)

cc @serhiy-storchaka who also seems to be actively maintaining IDLE.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Jun 22, 2022
Move test sub-packages to Lib/test #54781
Closed
@vstinner

vstinner commented Jun 22, 2022

Copy link
Copy Markdown
Member Author

Oh, I'm not sure how to copy this code from the removed test_idle.py:

if __name__ == '__main__':
    tk.NoDefaultRoot()
    unittest.main(exit=False)
    tk._support_default_root = True
    tk._default_root = None

Maybe put a setUpModule() method somewhere.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner added the skip news label Jun 23, 2022
vstinner added 10 commits June 23, 2022 14:11
@vstinner
gh-54781: Move Lib/idlelib/idle_test/ to Lib/test/test_idle/
67fc975
@vstinner
Remove Lib/test/test_idle.py
700b8df
@vstinner
Replace idlelib.idle_test with test.test_idle
2feaf52
@vstinner
idlelib: replace idlelib.idle_test with test.test_idle
0d914ae
@vstinner
test_idle/README.txt: Replace idle_test with test_idle
20e30ad
@vstinner
Update references
3c49b1c
@vstinner
Build sytem
8f79c60
@vstinner
Add test_idle.__main__ sub-module
98cebe4
@vstinner
Update tests
110cab2
@vstinner
Complete test_idle/__init__.py
d9c9920
Copy code from remove Lib/test/test_idle.py
@vstinner

vstinner commented Jun 23, 2022

Copy link
Copy Markdown
Member Author

PR rebased to fix a merge conflict (remove unused imports).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@terryjreedy terryjreedy mentioned this pull request Jul 20, 2022
IDLE: Move unittests to test directory #95069
Open
@terryjreedy terryjreedy changed the title gh-54781: Move Lib/idlelib/idle_test/ to Lib/test/test_idle/ gh-95069: Move Lib/idlelib/idle_test/ to Lib/test/test_idle/ Jul 20, 2022
terryjreedy
terryjreedy requested changes Jul 20, 2022
View reviewed changes

@terryjreedy terryjreedy left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

As I said elsewhere, idle_test/ should remain, so don't remove it. htest.py and maybe something else should remain there. Revert changes to from idlelib.idle_test.htest import run. In the future, I may put other non-unittest integration tests in idle_test, or try to automate some of the suggested manual tests in the htests.

I opened a new issue, #95069, for moving IDLE test and retargeted this PR to that issue.

I need to work on some substantive improvements to IDLE before I spend much more time on this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_idle/__main__.py
Comment on lines +1 to +4
from . import load_tests
import unittest

unittest.main()

@terryjreedy terryjreedy Jul 20, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

IDLE runs with NoDefaultRoot. It MUST be tested that way, at least when an IDLE maintainer runs test.test_idle directly.

Suggested change
from . import load_tests
import unittest
unittest.main()
from . import load_tests, tk
import unittest
tk.NoDefaultRoot()
unittest.main(exit=False)
tk._support_default_root = True
tk._default_root = None

The tk calls were originally in the main part of test_idle.py. Later, a change detector was added that detected the changes even though the two values were reverted to their original values. The change warning was turned into a test failure. So the temporary patching was moved to only apply when running test.test_idle as main. I consider this a hack and would prefer that IDLE always be tested the way it is run. I could then add a test that _support_default_root is false.

Victor, why is this reverted change treated differently from mock patching and unpatching? Does the change detector run by regrtest run before the reversion? If so, is there any way to patch the whole test run so that the change is undone before the change check? If not, can we find out what change is seen? (Perhaps NoDefaultRoot does more than I think.) If nothing else, could the change detector special case ignore these particular changes?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting changes and removed awaiting core review labels Jul 20, 2022
@bedevere-bot

bedevere-bot commented Jul 20, 2022

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Aug 3, 2022

Copy link
Copy Markdown
Member Author

Sorry I lost track of the issue. I mostly wrote it to see how it can go. It seems like you want to do it differently. Feel free to do it your way and copy/paste anything from this PR. I close my PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Aug 3, 2022
@vstinner
vstinner deleted the test_idle branch August 3, 2022 20:35
@sobolevn sobolevn mentioned this pull request Feb 14, 2024
gh-95069: Move tests from idlelib.idle_test to test.test_idle #115444
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@terryjreedy terryjreedy terryjreedy requested changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland will be requested when the pull request is marked ready for review erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner will be requested when the pull request is marked ready for review AA-Turner is a code owner
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping will be requested when the pull request is marked ready for review emmatyping is a code owner
@itamaro itamaro Awaiting requested review from itamaro itamaro will be requested when the pull request is marked ready for review itamaro is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @bedevere-bot @terryjreedy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.