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.
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
testsfailedcheck into the defaultpytest_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.