827 implement a yamlfilemanager#833
Merged
nathanjmcdougall merged 10 commits intomainfrom Jul 12, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
CodSpeed Instrumentation Performance ReportMerging #833 will not alter performanceComparing Summary
|
Handle cases of `YAMLFileManager.set_value` when root level config is not a mapping
Contributor
There was a problem hiding this comment.
Pull Request Overview
Implements a new YAMLFileManager abstraction with corresponding error types and comprehensive YAML tests, updates TOML tests for error matching, and refines the update_ruamel_yaml_map helper.
- Adds
YAMLFileManager,YAMLDocument, and related YAML error classes inio_.pyanderrors.py. - Expands YAML integration tests to cover read, write, set, delete, and list operations.
- Adjusts TOML tests for more precise error matching and renames a helper test.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usethis/integrations/file/yaml/test_yaml_io.py | Adds extensive integration tests for new YAMLFileManager behaviors |
| src/usethis/integrations/file/yaml/io.py | Implements YAMLFileManager and edit_yaml logic |
| src/usethis/_integrations/file/yaml/errors.py | Defines new YAML-related error classes |
| src/usethis/_integrations/file/yaml/update.py | Ensures nested dict values are updated with a CommentedMap guard |
| tests/usethis/integrations/file/toml/test_toml_io.py | Refines error assertions and renames a test for non-list removal |
Comments suppressed due to low confidence (2)
tests/usethis/integrations/file/toml/test_toml_io.py:666
- [nitpick] The test name
test_not_a_listis vague; consider renaming totest_remove_from_list_on_non_listto more accurately describe the behavior under test.
def test_not_a_list(self, tmp_path: Path) -> None:
src/usethis/integrations/file/yaml/io.py:198
- Avoid using
assertfor type validation since it can be disabled; consider raising a specific exception (e.g.,UnexpectedYAMLValueError) instead of relying onassert.
if not isinstance(content, CommentedMap):
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.