Skip to content

gh-69134: Harden NotebookTest.test_traversal#153403

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:harden-notebook-traversal
Jul 9, 2026
Merged

gh-69134: Harden NotebookTest.test_traversal#153403
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:harden-notebook-traversal

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

Follow-up to GH-152499. NotebookTest.test_traversal wasn't covered there and still fails intermittently on a real X11 display: identify(5, 5) runs before the notebook reaches its requested size, so the pixel lands outside the first tab and returns '' instead of 'padding'.

wait_until_mapped() gains an opt-in full_size flag that also waits until the realized size reaches the requested size; both identify(5, 5) assertions now use it. The default path is unchanged, so the other callers are unaffected.

The flake doesn't reproduce when test_traversal runs alone (0/40), but running the whole NotebookTest class reliably reproduces it, since the earlier methods leave the shared class root in a state where the notebook maps too small. Measured on a real X11 display: 14/15 failures without the fix, 0/20 with it (and no other assertion starts failing).

identify(5, 5) could run before the notebook reached its requested size,
so the pixel fell outside the first tab and returned ''.  Guard it with a
new opt-in wait_until_mapped(full_size=True).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir skip news 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 labels Jul 9, 2026
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Reproduction data (real X11 display):

  • test_traversal alone ×40 — 0 failures (does not reproduce in isolation).
  • whole NotebookTest class ×15 — 14 failures (~93%); the earlier methods leave the shared class root in a state where the notebook maps too small, so identify(5, 5) lands outside the first tab.
  • with this patch, NotebookTest class ×20 — 0 test_traversal failures and 0 other failures.

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) July 9, 2026 09:40
@serhiy-storchaka serhiy-storchaka merged commit 53b0498 into python:main Jul 9, 2026
60 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 53b04980284b668c27fc6d5adb0de19d38efe95b 3.13

@bedevere-app

bedevere-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

GH-153408 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 9, 2026
@bedevere-app

bedevere-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

GH-153409 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 9, 2026
serhiy-storchaka added a commit that referenced this pull request Jul 9, 2026
…53409)

identify(5, 5) could run before the notebook reached its requested size,
so the pixel fell outside the first tab and returned ''.  Guard it with a
new opt-in wait_until_mapped(full_size=True).
(cherry picked from commit 53b0498)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Jul 9, 2026
…53408)

identify(5, 5) could run before the notebook reached its requested size,
so the pixel fell outside the first tab and returned ''.  Guard it with a
new opt-in wait_until_mapped(full_size=True).
(cherry picked from commit 53b0498)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@bedevere-app

bedevere-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

GH-153415 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 9, 2026
@serhiy-storchaka serhiy-storchaka deleted the harden-notebook-traversal branch July 9, 2026 11:08
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.

1 participant