Skip to content

Introduce ExitCode.COLLECTION_ERROR for collection errors - #15012

Open
SemTiOne wants to merge 5 commits into
pytest-dev:mainfrom
SemTiOne:fix/4603-collection-error-exit-code
Open

Introduce ExitCode.COLLECTION_ERROR for collection errors#15012
SemTiOne wants to merge 5 commits into
pytest-dev:mainfrom
SemTiOne:fix/4603-collection-error-exit-code

Conversation

@SemTiOne

Copy link
Copy Markdown
Contributor

Closes #4603

Previously collection errors exited 2, they now exit 7 (ExitCode.COLLECTION_ERROR).

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits. Please uncheck this if you prefer to squash the commits yourself.
  • Add text like closes #XYZW to the PR description and/or commits (where XYZW is the issue number). See the github docs for more information.
  • If AI agents were used, they are credited in Co-authored-by commit trailers.
  • Create a new changelog file in the changelog directory, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Add yourself to AUTHORS in alphabetical order.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Sep 13, 2026

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

We may need to assess if this is breaking for some people

Comment thread src/_pytest/main.py
@RonnyPfannschmidt

Copy link
Copy Markdown
Member

ci fixed needed

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@SemTiOne SemTiOne changed the title [WIP] Introduce ExitCode.COLLECTION_ERROR for collection errors Introduce ExitCode.COLLECTION_ERROR for collection errors Sep 13, 2026
@SemTiOne
SemTiOne marked this pull request as ready for review September 13, 2026 13:17

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. More tests changed than code is a good sign.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

please investigate what triggered the rtd failure

@SemTiOne

Copy link
Copy Markdown
Contributor Author

GTG.

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.

Syntax error in test file makes pytest exit with exit code 2

3 participants