Skip to content

gh-153741: Harden IDLE GUI tests for newer Tk and display scaling#153742

Merged
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:idle-gui-tests-newer-tk
Jul 22, 2026
Merged

gh-153741: Harden IDLE GUI tests for newer Tk and display scaling#153742
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:idle-gui-tests-newer-tk

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 15, 2026

Copy link
Copy Markdown
Member

Several IDLE GUI tests fail on newer Tk or are fragile under display scaling. All test-only.

test_sidebar test_mousewheel fails on Tk 8.7+, which replaced the X11 <Button-4>/<Button-5> wheel events with <MouseWheel>; the test now sends the button events only on Tk before 8.7. Verified on Tk 8.5.19, 8.6.17, 8.7b1, 9.0.3 and 9.1b1.

test_configdialog compared ttk widget states with exact tuples, which break when a widget picks up transient active/hover states from the pointer (whose position shifts with the display scaling). The tested methods only toggle disabled, so the tests now assert that flag alone.

Several test_configdialog tests re-mask a method at the end, which is skipped on a mid-test failure (leaving the real method in place for the rest of the class); addCleanup() now makes the restore unconditional.

🤖 Generated with Claude Code

Use <MouseWheel> instead of the X11 <Button-4>/<Button-5> events, which
Tk 8.7 dropped, in test_sidebar's test_mousewheel.

In test_configdialog, assert the 'disabled' state flag alone instead of
the exact ttk state tuple (which transient pointer states break), and
restore the tests' method masks with addCleanup().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jul 15, 2026
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news labels Jul 15, 2026
@terryjreedy

Copy link
Copy Markdown
Member

After merging this, I will move the x11_buttons comment and definition to util.py in a followup, to be used in a binding function.

@terryjreedy
terryjreedy merged commit a2581eb into python:main Jul 22, 2026
60 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

GH-154404 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 22, 2026
@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

GH-154405 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 22, 2026
@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

GH-154406 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 22, 2026
terryjreedy pushed a commit that referenced this pull request Jul 22, 2026
…ing (GH-153742) (#154406)

gh-153741: Harden IDLE GUI tests for newer Tk and display scaling (GH-153742)

In test_sidebar.test_mousewheel, only use the X11 <Button-4>/<Button-5> events when testing on
x11 Tk before 8.7.  Otherwise, use <Mousewheel> as on other systems.

In test_configdialog, assert the 'disabled' state flag alone instead of
the exact ttk state tuple (which transient pointer states break), and
restore the tests' method masks with addCleanup().
(cherry picked from commit a2581eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
terryjreedy pushed a commit that referenced this pull request Jul 22, 2026
…ing (GH-153742) (#154404)

gh-153741: Harden IDLE GUI tests for newer Tk and display scaling (GH-153742)

In test_sidebar.test_mousewheel, only use the X11 <Button-4>/<Button-5> events when testing on
x11 Tk before 8.7.  Otherwise, use <Mousewheel> as on other systems.

In test_configdialog, assert the 'disabled' state flag alone instead of
the exact ttk state tuple (which transient pointer states break), and
restore the tests' method masks with addCleanup().
(cherry picked from commit a2581eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
terryjreedy pushed a commit that referenced this pull request Jul 22, 2026
…ing (GH-153742) (#154405)

gh-153741: Harden IDLE GUI tests for newer Tk and display scaling (GH-153742)

In test_sidebar.test_mousewheel, only use the X11 <Button-4>/<Button-5> events when testing on
x11 Tk before 8.7.  Otherwise, use <Mousewheel> as on other systems.

In test_configdialog, assert the 'disabled' state flag alone instead of
the exact ttk state tuple (which transient pointer states break), and
restore the tests' method masks with addCleanup().
(cherry picked from commit a2581eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants