Skip to content

Fix regression making --pdb unusable without configured reruns - #343

Open
icemac wants to merge 1 commit into
masterfrom
fix-342-pdb-regression
Open

Fix regression making --pdb unusable without configured reruns#343
icemac wants to merge 1 commit into
masterfrom
fix-342-pdb-regression

Conversation

@icemac

@icemac icemac commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #342.

Since 16.5, check_options() runs unconditionally in pytest_configure (#332), and its guard config.option.reruns != 0 is always true when --reruns is 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.

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 sallner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: --reruns incompatible with --pdb in version 16.5 even if not setting --reruns

2 participants