Skip to content

Handle BaseExceptionGroup during fixture teardown in SetupState.teardown_exact - #15489

Open
kingroyale537 wants to merge 1 commit into
pytest-dev:mainfrom
kingroyale537:fix/teardown-base-exception-group
Open

kingroyale537 wants to merge 1 commit into
pytest-dev:mainfrom
kingroyale537:fix/teardown-base-exception-group

Conversation

@kingroyale537

Copy link
Copy Markdown

Fixes #15329.

SetupState.teardown_exact() only caught TEST_OUTCOME (OutcomeException | Exception), so a BaseExceptionGroup raised during fixture teardown (e.g. wrapping asyncio.CancelledError) escaped mid-loop without running remaining finalizers or invalidating cached fixtures.

Include BaseExceptionGroup in the except clause so all remaining finalizers still run and get collected.

This branch has not been deployed

No deployments
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.

BaseExceptionGroup during fixture teardown skips remaining finalizers and reuses a cached function-scoped fixture

1 participant