Skip to content

Collection-error abort check lives in pytest_runtestloop instead of pytest_collection #15028

Description

@SemTiOne

What's the problem this feature will solve?

The collection-error abort check lives in the default pytest_runtestloop (src/_pytest/main.py), so the runtest phase inspects leftovers from collection instead of collection guarding itself.

Describe the solution you'd like

Move the testsfailed check into the default pytest_collection, keeping the exception and exit code. Both hooks are firstresult hooks, so audit which implementations bypass the check before moving it.

Alternative Solutions

Leave as is (behavior is correct).

Additional context

Deferred from #15012 (#15012 (comment)). This can be closed as wontfix if the compatibility impact outweighs the benefit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions