Skip to content

Fix nested caplog.filtering early removal#14284

Open
oaksprout wants to merge 8 commits intopytest-dev:mainfrom
oaksprout:fix-nested-caplog-filtering
Open

Fix nested caplog.filtering early removal#14284
oaksprout wants to merge 8 commits intopytest-dev:mainfrom
oaksprout:fix-nested-caplog-filtering

Conversation

@oaksprout
Copy link

Closes #14189. Nested caplog.filtering usage was eagerly removing filters when the inner context manager exited, even if the filter was already present from the outer context manager. This PR ensures the filter is only removed if it wasn't already present when the context manager was entered.

Closes pytest-dev#14189 by checking if the filter is already present before adding or removing it.
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 13, 2026
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.

Nested caplog.filtering usage may remove filters early

1 participant