Fix regression making --pdb unusable without configured reruns - #343
Open
icemac wants to merge 1 commit into
Open
Fix regression making --pdb unusable without configured reruns#343icemac wants to merge 1 commit into
icemac wants to merge 1 commit into
Conversation
The --pdb incompatibility check in check_options() treated an unset --reruns option (None) as configured because of `None != 0`. This was harmless while the check only ran once reruns were resolved per item, but #332 moved it to pytest_configure, so it fired unconditionally. Resolve the actually configured global reruns (CLI, ini, --force-reruns) in check_options() and restore a per-item check for marker-driven reruns. Fixes #342.
sallner
approved these changes
Aug 14, 2026
sallner
left a comment
Member
There was a problem hiding this comment.
I generally like the changes and they look sound. Tests were added that cover the mentioned problem.
| if reruns is not None: | ||
| return reruns | ||
|
|
||
| reruns = None |
Member
There was a problem hiding this comment.
I do not understand this line. The check in L173 should ensure that reruns is None.
It seems that .getvalue() is deprecated anyhow https://github.com/pytest-dev/pytest/blob/68308aa288e00ff84880572ed9b3590f6cd7d470/src/_pytest/config/__init__.py#L2096 and the recommended .getoption() actually allows to set a default value which could be None here. https://github.com/pytest-dev/pytest/blob/68308aa288e00ff84880572ed9b3590f6cd7d470/src/_pytest/config/__init__.py#L2071
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #342.
Since 16.5,
check_options()runs unconditionally inpytest_configure(#332), and its guardconfig.option.reruns != 0is always true when--rerunsis unset (None != 0). Now the check resolves the actually configured reruns (CLI, ini,--force-reruns), and marker-driven reruns are rejected per item as in 16.4.