Skip to content

Test that all KeyValueFileManagers support empty files#1467

Merged
nathanjmcdougall merged 2 commits intomainfrom
copilot/test-keyvaluefilemanagers-empty-files
Mar 25, 2026
Merged

Test that all KeyValueFileManagers support empty files#1467
nathanjmcdougall merged 2 commits intomainfrom
copilot/test-keyvaluefilemanagers-empty-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

Empty files should be valid for all KeyValueFileManager subclasses and correspond to an empty map. This is a prerequisite for #241 (lazy pyproject.toml creation from within config methods).

Adds tests for each manager type (TOMLFileManager, YAMLFileManager, INIFileManager) verifying:

  • read_file() succeeds on an empty file
  • __getitem__([]) returns {}
  • __contains__([]) returns True
  • __contains__ with a nonexistent key returns False

All three parsers already handle empty content correctly — these tests codify that guarantee.

Original prompt

This section details on the original issue you should resolve

<issue_title>Test that all KeyValueFileManagers support empty files</issue_title>
<issue_description>> We should test that all KeyValueFileManagers support empty files. This will be needed for #241 where we are moving away from creating pyproject.toml eagerly and creating it from within the add config method, but that requires the ability to create an initial empty file. My inclination is that empty files should always be valid and just correspond to an empty map.

Originally posted by @nathanjmcdougall in #663</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add tests for KeyValueFileManagers to support empty files Test that all KeyValueFileManagers support empty files Mar 22, 2026
Copilot AI requested a review from nathanjmcdougall March 22, 2026 19:17
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/test-keyvaluefilemanagers-empty-files (f600d16) with main (43ce117)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 25, 2026 00:14
@nathanjmcdougall nathanjmcdougall merged commit 62f392c into main Mar 25, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/test-keyvaluefilemanagers-empty-files branch March 25, 2026 00:15
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.

Test that all KeyValueFileManagers support empty files

2 participants