Skip to content

Abort collection errors from pytest_collection - #15061

Open
gyanu2507 wants to merge 1 commit into
pytest-dev:mainfrom
gyanu2507:fix/collection-error-abort
Open

gyanu2507 wants to merge 1 commit into
pytest-dev:mainfrom
gyanu2507:fix/collection-error-abort

Conversation

@gyanu2507

@gyanu2507 gyanu2507 commented Sep 18, 2026

Copy link
Copy Markdown

Fixes #15028.

The collection-error abort lives in the default pytest_runtestloop. That hook is firstresult, so a plugin that implements it never hits the check and will run tests (or do something else) after collection failed.

Move the testsfailed check into the default pytest_collection. --continue-on-collection-errors is unchanged. --collect-only still aborts, because the raise now happens before pytest_runtestloop returns early.

This is a documented behaviour change for plugins that replace pytest_collection entirely. @bluetech said that's the right place for the check and to treat it as deferred to the next major.

The testsfailed check lived in pytest_runtestloop, so a plugin
that replaced that hook skipped the abort. Move it to the default
pytest_collection implementation.

Fixes pytest-dev#15028
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Sep 18, 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.

Collection-error abort check lives in pytest_runtestloop instead of pytest_collection

1 participant