Skip to content

827 implement a yamlfilemanager#833

Merged
nathanjmcdougall merged 10 commits intomainfrom
827-implement-a-yamlfilemanager
Jul 12, 2025
Merged

827 implement a yamlfilemanager#833
nathanjmcdougall merged 10 commits intomainfrom
827-implement-a-yamlfilemanager

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Jul 8, 2025 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 99.29577% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_integrations/file/yaml/io_.py 99.25% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jul 8, 2025

CodSpeed Instrumentation Performance Report

Merging #833 will not alter performance

Comparing 827-implement-a-yamlfilemanager (f5a664d) with main (7316d03)

Summary

✅ 2 untouched benchmarks

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review July 12, 2025 03:50
@nathanjmcdougall nathanjmcdougall requested a review from Copilot July 12, 2025 03:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 in io_.py and errors.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_list is vague; consider renaming to test_remove_from_list_on_non_list to 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 assert for type validation since it can be disabled; consider raising a specific exception (e.g., UnexpectedYAMLValueError) instead of relying on assert.
        if not isinstance(content, CommentedMap):

@nathanjmcdougall nathanjmcdougall merged commit 79b2c49 into main Jul 12, 2025
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 827-implement-a-yamlfilemanager branch July 12, 2025 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a YAMLFileManager

2 participants