test(git): add tests for get_filenames_in_commit with git_reference#1890
Open
HankyStyle wants to merge 1 commit intocommitizen-tools:masterfrom
Open
test(git): add tests for get_filenames_in_commit with git_reference#1890HankyStyle wants to merge 1 commit intocommitizen-tools:masterfrom
HankyStyle wants to merge 1 commit intocommitizen-tools:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1890 +/- ##
=======================================
Coverage 97.99% 97.99%
=======================================
Files 60 60
Lines 2689 2689
=======================================
Hits 2635 2635
Misses 54 54 ☔ View full report in Codecov by Sentry. |
Lee-W
reviewed
Mar 8, 2026
| util.create_file_and_commit("feat: add new feature", filename=filename) | ||
|
|
||
| filenames = git.get_filenames_in_commit() | ||
| assert filename in filenames |
Member
There was a problem hiding this comment.
should it be
Suggested change
| assert filename in filenames | |
| assert [filename] == filenames |
instead?
Collaborator
There was a problem hiding this comment.
+1
and probably add another commit with more files to validate the behavior that the function only resolves filenames from the last commit
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.
Description
Add missing test coverage for the
get_filenames_in_commitfunction.This PR adds:
test_get_filenames_in_commit: happy path test withoutgit_reference, verifying correct filenames are returned from the last committest_get_filenames_in_commit_with_git_reference: happy path test with a specific commit SHA asgit_reference, verifying only files from that specific commit are returnedCloses #1860
Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.6 + Antigravity
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
uv run poe doclocally to ensure the documentation pages renders correctlyExpected Behavior
Running
uv run pytest tests/test_git.py -k "get_filenames_in_commit"should pass all 3 tests:test_get_filenames_in_commit— returns correct filename from the last committest_get_filenames_in_commit_with_git_reference— returns only files from the specified commit SHA, not from other commitstest_get_filenames_in_commit_error— raisesGitCommandErrorwhen git command fails (existing test, unchanged)Steps to Test This Pull Request
Additional Context
Related issue: #1860