Skip to content

fix: validate explicit config file paths#14723

Open
wanxiankai wants to merge 1 commit into
pytest-dev:mainfrom
wanxiankai:fix/config-file-validation
Open

fix: validate explicit config file paths#14723
wanxiankai wants to merge 1 commit into
pytest-dev:mainfrom
wanxiankai:fix/config-file-validation

Conversation

@wanxiankai

Copy link
Copy Markdown

Closes #14716.

Summary

  • Validate explicit -c/--config-file paths before attempting to load them.
  • Raise a clean usage error for missing config files and unsupported config file extensions.
  • Add regression coverage for both CLI entry points and direct determine_setup() calls.

Testing

  • .venv/bin/python -m pytest testing/test_config.py::TestConfigCmdlineParsing::test_explicitly_specified_invalid_config_file_errors testing/test_config.py::TestRootdir::test_with_invalid_specific_inifile -q
  • .venv/bin/python -m pytest testing/test_config.py testing/test_findpaths.py -q
  • .venv/bin/tox -e py314 -- testing/test_config.py testing/test_findpaths.py
  • .venv/bin/tox -e linting

AI assistance was used while preparing this change and is credited in the commit trailer.

Co-authored-by: OpenAI Codex <codex@openai.com>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 19, 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.

-c/--config-file has two failure modes for invalid paths: silent no-op for unrecognized extensions, and raw FileNotFoundError for recognized ones

1 participant