gh-143990: Do not assume the requested font size in test_font by serhiy-storchaka · Pull Request #153322 · python/cpython · GitHub
Skip to content

gh-143990: Do not assume the requested font size in test_font - #153322

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-143990-test-font-actual-size
Jul 8, 2026
Merged

gh-143990: Do not assume the requested font size in test_font#153322
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-143990-test-font-actual-size

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

On platforms that provide only bitmap fonts (for example the AMD64 Alpine Linux buildbot) a font created from a description such as ('Times', 20, 'bold') does not keep the requested size: Tk substitutes the nearest available size. The test_create and test_existing tests added in GH-152025 asserted the exact requested size (20) and therefore failed there.

This asks Tk for the size it actually resolves for the description (via font actual) instead of assuming the requested value. The keyword/explicit-size assertions are unchanged, since those set the size directly.

🤖 Generated with Claude Code

On platforms with only bitmap fonts Tk substitutes the nearest
available size, so query the resolved size instead of assuming it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@weixlu

weixlu commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

@serhiy-storchaka
serhiy-storchaka merged commit 841e454 into python:main Jul 8, 2026
52 of 54 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the gh-143990-test-font-actual-size branch July 15, 2026 11:50
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