Skip to content

Fix two flaky tests: slow-teardown timing and pdb EOF race - #15151

Merged
RonnyPfannschmidt merged 2 commits into
mainfrom
claude/project-thread-o2uoxy-windows-timing
Oct 8, 2026
Merged

RonnyPfannschmidt merged 2 commits into
mainfrom
claude/project-thread-o2uoxy-windows-timing

Conversation

@RonnyPfannschmidt

@RonnyPfannschmidt RonnyPfannschmidt commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Requested by Ronny · project thread

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.

Before: two tests fail intermittently in CI.

After: both tests are stable.

How

  • Timing test: the assertion is now < 0.3. The test guards against test_a1's 300 ms teardown leaking into test_a2's reported time, and such a leak adds at least 0.3s. The measured 0.19–0.25s values are test_a2's own runtime on a slow runner, so < 0.3 still catches the leak without depending on runner speed.
  • pdb test: it sent EOF right after seeing the readouterr() output, while pdb could still be processing the command, and the EOF was sometimes lost. It now waits for the next (Pdb) prompt first, like the other tests in test_debugging.py. Locally, under xdist with 16 workers, the test failed 7 of 600 runs before and 0 of 450 after.

Test-only changes, no changelog entry.

  • Allow maintainers to push and squash when merging my commits.
  • If AI agents were used, they are credited in Co-authored-by commit trailers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RPVUqQy85BXtPFPctRc71n

test_console_output_style_times_slow_teardown_does_not_leak asserted that
test_a2 takes under 0.1s. Windows CI measured 0.19s and 0.25s, which
is test_a2's own runtime, not a leaked 0.3s teardown. Assert < 0.3s,
which still catches the leak.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPVUqQy85BXtPFPctRc71n
@RonnyPfannschmidt RonnyPfannschmidt added the skip news used on prs to opt out of the changelog requirement label Oct 7, 2026 — with Claude
@RonnyPfannschmidt RonnyPfannschmidt self-assigned this Oct 7, 2026

RonnyPfannschmidt commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.

build (ubuntu-py310-xdist) failed in TestPDB::test_pdb_and_capsys with a pexpect timeout. It's a real race in the test: EOF was sent before pdb showed its next prompt. I reproduced it locally (7 failures in 600 runs) and fixed it in this PR (0 failures in 450 runs); see the updated description.

The test sent EOF right after seeing the readouterr() output, while pdb
could still be processing the command. The EOF was then sometimes lost
and the child kept waiting for input until pexpect timed out (about 1
in 85 runs under xdist locally). Waiting for the next (Pdb) prompt, as
the other tests in this module do, fixes it: 0 failures in 450 runs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPVUqQy85BXtPFPctRc71n
@RonnyPfannschmidt RonnyPfannschmidt changed the title Relax timing threshold in slow-teardown terminal test Fix two flaky tests: slow-teardown timing and pdb EOF race Oct 7, 2026
@RonnyPfannschmidt
RonnyPfannschmidt merged commit 7edc6b0 into main Oct 8, 2026
36 checks passed
@RonnyPfannschmidt
RonnyPfannschmidt deleted the claude/project-thread-o2uoxy-windows-timing branch October 8, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news used on prs to opt out of the changelog requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants