Skip to content

stop test session on BdbQuit from pdb#14714

Open
EternalRights wants to merge 2 commits into
pytest-dev:mainfrom
EternalRights:fix/ctrl-d-stop-session-13453
Open

stop test session on BdbQuit from pdb#14714
EternalRights wants to merge 2 commits into
pytest-dev:mainfrom
EternalRights:fix/ctrl-d-stop-session-13453

Conversation

@EternalRights

Copy link
Copy Markdown
Contributor

Was testing pdb with --pdb on Python 3.14 and noticed Ctrl+D behaves differently than 3.13 -- on 3.13 it fails the current test and keeps going, on 3.14 it just quits the whole session without even reporting the failure. Neither is great.

Ronny's call in #13453 was "fail + should stop in all cases", so that's what this does. When BdbQuit comes up during any runtest phase, set session.shouldstop -- the current test still gets reported as failed, teardown runs normally, then the session stops.

Removed the xfail on test_raises_bdbquit_with_eoferror and added a second test to verify the session actually stops. Also updated test_BdbQuit in test_unittest.py since test_should_not_run no longer runs.

One thing I wasn't sure about: the shouldstop message is "Debugger quit (BdbQuit)". Happy to change it if there's a preferred format.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 16, 2026
Turns out the CPython change in 3.14 doesn't just suppress
BdbQuit -- pdb calls os._exit(0) directly, which gives pytest
no chance to react. The call_and_report handler still catches
BdbQuit raised from code (like the unittest test), but Ctrl+D
simulation via EOFError is fundamentally unreachable on 3.14+.

Updated the changelog to be honest about the limitation instead
of claiming consistency across all versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant