Skip to content

Fix finalizer state after fixture setup errors - #14792

Open
DresdenGman wants to merge 2 commits into
pytest-dev:mainfrom
DresdenGman:fix-class-fixture-warning-finalizers
Open

Fix finalizer state after fixture setup errors#14792
DresdenGman wants to merge 2 commits into
pytest-dev:mainfrom
DresdenGman:fix-class-fixture-warning-finalizers

Conversation

@DresdenGman

Copy link
Copy Markdown

Fixes #14775.

When fixture setup raises before cached_result is set, the fixture post-finalizer remains in _finalizers. A later request for the same class-scoped fixture then trips the internal assertion.

Clear the fixture-local finalizers on setup failure and add a regression case with two tests under -Werror.

Tests:

  • python -m pytest testing/deprecated_test.py::test_class_scope_instance_method_is_deprecated -q

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 28, 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.

Internal AssertionError after class scoped fixture warning

1 participant