Skip to content

fix(config): raise UsageError for invalid or missing -c/--config-file paths - #14793

Closed
amir-rezaei wants to merge 3 commits into
pytest-dev:mainfrom
amir-rezaei:fix/config-file-path-validation-usage-error
Closed

fix(config): raise UsageError for invalid or missing -c/--config-file paths#14793
amir-rezaei wants to merge 3 commits into
pytest-dev:mainfrom
amir-rezaei:fix/config-file-path-validation-usage-error

Conversation

@amir-rezaei

Copy link
Copy Markdown

Description

This PR resolves issue #14716 by validating explicit -c/--config-file paths in src/_pytest/config/findpaths.py.

Details

  • Converts uncaught FileNotFoundError into a clean UsageError.
  • Raises UsageError when an explicit --config-file path does not exist or has an unrecognized extension instead of silently falling back.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 28, 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.

3 participants