Visitar URL original
Abort collection errors from pytest_collection by gyanu2507 · Pull Request #15061 · pytest-dev/pytest · GitHub
Skip to content

Abort collection errors from pytest_collection - #15061

Closed
gyanu2507 wants to merge 2 commits into
pytest-dev:mainfrom
gyanu2507:fix/collection-error-abort
Closed

gyanu2507 wants to merge 2 commits 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 #15028
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Sep 18, 2026
@gyanu2507

Copy link
Copy Markdown
Author

Closing this to narrow my open-source work to fewer projects. Anyone is welcome to pick the change up if it's useful.

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