You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConfigMixIn expands every template path through glob.glob(filename, recursive=True). When the path is a real file whose name contains glob metacharacters, the brackets are read as a character class instead of literal text: the glob matches nothing and the template is silently dropped, or the pattern blows up on a bad character range. The reported case is the file name pytest's snapshot plugin produces:
The fix checks the literal path first — if Path(filename).is_file() it is used as-is, otherwise the existing glob expansion runs unchanged. Patterns keep working exactly as before; a path that already resolves to a file is simply never reinterpreted as a pattern.
Test: test_config_literal_path_with_glob_characters creates template[1].yaml in a temporary directory and asserts it survives into config.templates. It fails on main (the list comes back empty) and passes with the fix.
AI-assisted (LLM used for drafting and for running the checks); the analysis and the runs are mine.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Ping — this has been open since 6 August with no review yet.
ConfigMixIn expands every template path through glob.glob(filename, recursive=True), so a path that is a real file whose name contains glob metacharacters gets read as a character class: the glob matches nothing and the template is silently dropped, or it fails on a bad character range. The reported case is the filename pytest's snapshot plugin produces, test_snapshot[emr--tests--emr.template.2.yaml].yaml. The fix checks Path(filename).is_file() first and otherwise runs the existing glob expansion unchanged, so patterns behave exactly as before.
No CI has run on it: the check suite for e54c80e is at action_required with zero runs, so it needs a maintainer to approve the workflow. The branch is also behind main by now — happy to rebase.
Happy to close it if you would rather fix #2136 another way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: Fixes #2136
Description of changes:
ConfigMixInexpands every template path throughglob.glob(filename, recursive=True). When the path is a real file whose name contains glob metacharacters, the brackets are read as a character class instead of literal text: the glob matches nothing and the template is silently dropped, or the pattern blows up on a bad character range. The reported case is the file name pytest's snapshot plugin produces:The fix checks the literal path first — if
Path(filename).is_file()it is used as-is, otherwise the existing glob expansion runs unchanged. Patterns keep working exactly as before; a path that already resolves to a file is simply never reinterpreted as a pattern.Test:
test_config_literal_path_with_glob_characterscreatestemplate[1].yamlin a temporary directory and asserts it survives intoconfig.templates. It fails onmain(the list comes back empty) and passes with the fix.AI-assisted (LLM used for drafting and for running the checks); the analysis and the runs are mine.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.