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-54781: Move Lib/tkinter/test/test_ttk/ to Lib/test/test_ttk/ by vstinner · Pull Request #94070 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 21, 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/tkinter/test/ to Lib/test/test_tkinter/.

Rename test_tk to test_tkinter, and rename test_ttk_guionly to test_ttk.

  • Move test sub-packages to Lib/test #54781

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
vstinner requested a review from a team as a code owner June 21, 2022 15:39
@bedevere-bot bedevere-bot added the awaiting core review label Jun 21, 2022
@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

I can still run tests on an newly installed (patched) Python 3.12:

$ /opt/py3.12/bin/python3.12 -m test test_tkinter -u all -v
(...)
Ran 731 tests in 6.853s

$ /opt/py3.12/bin/python3.12 -m test test_ttk -u all -v
(...)
Ran 308 tests in 7.905s

$ /opt/py3.12/bin/python3.12 -m test test_tkinter
test_tkinter skipped -- Use of the 'gui' resource not enabled
test_tkinter skipped (resource denied)

$ /opt/py3.12/bin/python3.12 -m test test_ttk
test_ttk skipped -- Use of the 'gui' resource not enabled
test_ttk skipped (resource denied)
All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

Rename test_tk to test_tkinter

For me, it's disturbing when tests don't have the same name than the tested module. asyncio => test_asyncio. tkinter => test_tk ???

rename test_ttk_guionly to test_ttk

I can keep test_ttk_guionly name if you prefer, but for me, tests should use the GUI. Only the special tests test_ttk_textonly should have a special name, no?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

cc @terryjreedy @serhiy-storchaka

All reactions

Sorry, something went wrong.

Uh oh!

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

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

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

This PR is special. I made the new directory tree "flat". support.py and test_simpledialog.py now lives in Lib/test/test_tkinter/. Previously, test_simpledialog.py was in a test_tkinter/ sub-directory.

Before:

Lib/tkinter/test/
Lib/tkinter/test/README
Lib/tkinter/test/__init__.py
Lib/tkinter/test/support.py
Lib/tkinter/test/test_tkinter
Lib/tkinter/test/test_tkinter/__init__.py
Lib/tkinter/test/test_tkinter/test_colorchooser.py
Lib/tkinter/test/test_tkinter/test_font.py
Lib/tkinter/test/test_tkinter/test_geometry_managers.py
Lib/tkinter/test/test_tkinter/test_images.py
Lib/tkinter/test/test_tkinter/test_loadtk.py
Lib/tkinter/test/test_tkinter/test_messagebox.py
Lib/tkinter/test/test_tkinter/test_misc.py
Lib/tkinter/test/test_tkinter/test_simpledialog.py
Lib/tkinter/test/test_tkinter/test_text.py
Lib/tkinter/test/test_tkinter/test_variables.py
Lib/tkinter/test/test_tkinter/test_widgets.py
Lib/tkinter/test/test_ttk
Lib/tkinter/test/test_ttk/__init__.py
Lib/tkinter/test/test_ttk/test_extensions.py
Lib/tkinter/test/test_ttk/test_style.py
Lib/tkinter/test/test_ttk/test_widgets.py
Lib/tkinter/test/widget_tests.py

After:

Lib/test/test_ttk/
Lib/test/test_ttk/__init__.py
Lib/test/test_ttk/test_extensions.py
Lib/test/test_ttk/test_style.py
Lib/test/test_ttk/test_widgets.py

Lib/test/test_tkinter/
Lib/test/test_tkinter/README
Lib/test/test_tkinter/__init__.py
Lib/test/test_tkinter/support.py
Lib/test/test_tkinter/test_colorchooser.py
Lib/test/test_tkinter/test_font.py
Lib/test/test_tkinter/test_geometry_managers.py
Lib/test/test_tkinter/test_images.py
Lib/test/test_tkinter/test_loadtk.py
Lib/test/test_tkinter/test_messagebox.py
Lib/test/test_tkinter/test_misc.py
Lib/test/test_tkinter/test_simpledialog.py
Lib/test/test_tkinter/test_text.py
Lib/test/test_tkinter/test_variables.py
Lib/test/test_tkinter/test_widgets.py
Lib/test/test_tkinter/widget_tests.py
All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

Windows (x64) job failed but I cannot get the logs. I cancelled the workflow. I still cannot see the logs. Strange.

All reactions

Sorry, something went wrong.

Uh oh!

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

@zware

zware commented Jun 21, 2022

Copy link
Copy Markdown
Member

Windows (x64) job failed but I cannot get the logs. I cancelled the workflow. I still cannot see the logs. Strange.

The failure is unrelated, see #94068.

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka
serhiy-storchaka requested review from serhiy-storchaka and removed request for a team June 21, 2022 15:54
@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

Oh. Windows build failed with an unrelated error:

Error: D:\a\cpython\cpython\Modules\socketmodule.c(7475,5): error C2065: 'HVSOCKET_CONTAINER_PASSTHRU': undeclared identifier [D:\a\cpython\cpython\PCbuild_socket.vcxproj]

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Jun 21, 2022
@vstinner vstinner reopened this Jun 21, 2022
@zooba

zooba commented Jun 21, 2022

Copy link
Copy Markdown
Member

Yeah, seems we're in the middle of the rollout of new CI images, so there's a chance you'll get the older image and not see the error. But you'll need my PR for it to be reliable.

All reactions

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed Jun 21, 2022
View reviewed changes
Comment thread Lib/test/test_tkinter/__init__.py Outdated

@serhiy-storchaka serhiy-storchaka Jun 21, 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.

Does python -m test.test_tkinter still work?

Sorry, something went wrong.

Uh oh!

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

All reactions

@merwok merwok Jun 21, 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.

It would work if a __main__ module gets added. But it was test.test_tk before, not test.test_tkinter.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Jun 21, 2022

Copy link
Copy Markdown
Member Author

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.

Ah you care about this command? If you do, I can add a __main__.py file.

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka Jun 21, 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.

Yes, please add it. And test different ways of running tests:

python -m test.test_xxx
python -m unittest test.test_xxx
python -m test test_xxx

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Jun 21, 2022

Copy link
Copy Markdown
Member Author

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.

I added __main__ sub-modules. Example:

./python -m test.test_ttk -v
./python -m test test_ttk -v -u all
./python -m unittest test.test_ttk -v

The 3 commands end with: Ran 308 tests.

Sorry, something went wrong.

Uh oh!

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

merwok reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Lib/test/test_tkinter/__init__.py Outdated

@serhiy-storchaka serhiy-storchaka Jun 21, 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.

Why not use just loader.discover()?

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Jun 21, 2022

Copy link
Copy Markdown
Member Author

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.

I copy/paste the code from test_asyncio, it works, so I didn't change it :-)

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka Jun 21, 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.

Does loader.discover() work with zipimport?

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Jun 21, 2022

Copy link
Copy Markdown
Member Author

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.

Does loader.discover() work with zipimport?

I have no idea. If there is an issue, I suggest to fix all load_tests() functions of Lib/test/ in a separated PR.

Sorry, something went wrong.

Uh oh!

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

All reactions
@serhiy-storchaka

serhiy-storchaka commented Jun 21, 2022

Copy link
Copy Markdown
Member

Should it be backported?

All reactions

Sorry, something went wrong.

Uh oh!

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

@terryjreedy

terryjreedy commented Jun 21, 2022

Copy link
Copy Markdown
Member

I would prefer that ttk tests be included under test_tkinter, with names like test_ttk_widgets, so that python -m test.test_tkinter (and python -m test -ugui test_tkinter) tests everything. But re-organization details are up to Serhiy.

All reactions

Sorry, something went wrong.

Uh oh!

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

@terryjreedy

terryjreedy commented Jun 21, 2022

Copy link
Copy Markdown
Member

This patch will require changes to the scripts *nix distributions use to make tkinter (and IDLE) a separate install. I don't know how they would feel about backports.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

I rebased the PR to get the fix for the Windows build: #94068

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

Should it be backported?

This specific PR change the name of two tests, so no, it should not be backported.

It also changes the build system (Linux, VS project). Honestly, it sounds risky and I would prefer to not backport it.

merwok 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 commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

I would prefer that ttk tests be included under test_tkinter

Oh. I tried to minimize changes in this PR. But I'm open to reorganizing tests.

@serhiy-storchaka: Are you fine with the 2 proposed tests, or do you want to merge them?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

This patch will require changes to the scripts *nix distributions use to make tkinter (and IDLE) a separate install. I don't know how they would feel about backports.

Once issue #54781 will be fixed, I will properly document these changes in What's New in Python 3.12. IMO it fits into the Build Changes section.

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka

serhiy-storchaka commented Jun 21, 2022

Copy link
Copy Markdown
Member

Are you fine with the 2 proposed tests, or do you want to merge them?

I was going to ask about merging them, but I am fine with the current state of this PR. If you are going to merge test_ttk into test_tkinter, do not forget about test_tcl.

Maybe do this in a separate PR?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

I was going to ask about merging them, but I am fine with the current state of this PR. If you are going to merge test_ttk into test_tkinter, do not forget about test_tcl.

Oh, merging 3 Tkinter tests sound out of my skills. I don't know well this module and I would prefer if someone else do it.

Here I'm trying to focus on fixing the 12 years old issue #54781 :-) Perfect is the enemy of good ;-)

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 21, 2022

Copy link
Copy Markdown
Member Author

@serhiy-storchaka: Does it look good to you like that?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jun 22, 2022

Copy link
Copy Markdown
Member Author

@serhiy-storchaka wrote "I am fine with the current state of this PR". I plan to merge the PR tomorrow if I don't hear back from @serhiy-storchaka.

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner added 3 commits June 22, 2022 19:14
@vstinner
gh-54781: Move Lib/tkinter/test/test_ttk/ to Lib/test/test_ttk/
9844364
* Add Lib/test/test_ttk/__init__.py based on test_ttk_guionly.py.
* Remove Lib/test/test_ttk_guionly.py.
@vstinner
Move Lib/tkinter/test/ to Lib/test/test_tkinter/
0f60bef
@vstinner
Add Lib/test/test_tkinter/__init__.py
8ee5ffe
Remove Lib/test/test_tk.py.
matejc pushed a commit to matejc/nixpkgs that referenced this pull request Sep 24, 2025
@thunze @matejc
python313Packages.tkinter: fix test selection for darwin, older python
a6ec45e
python/cpython#94070
tm-drtina pushed a commit to awakesecurity/nixpkgs that referenced this pull request Sep 29, 2025
@thunze @tm-drtina-arista
python313Packages.tkinter: fix test selection for darwin, older python
fa0cc8a
python/cpython#94070
@hugovk hugovk mentioned this pull request Oct 4, 2026
Remove else block for Python 3.11 and earlier python/release-tools#448
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merwok merwok merwok left review comments
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

7 participants

@vstinner @zware @zooba @serhiy-storchaka @terryjreedy @merwok @bedevere-bot
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.