test: mock git config in signoff ignore-author test - #481
Conversation
test_default_signoff_skips_ignored_author did not mock get_git_config_value. Since author resolution reads git config user.name first when validating a prospective message, the test failed whenever the developer had user.name configured locally (it only passed in environments where user.name was unset). Mock it to return an empty string so resolution deterministically falls back to the commit author.
✅ Deploy Preview for commit-check ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughChangesAuthor resolution test
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #481 +/- ##
=======================================
Coverage 97.28% 97.28%
=======================================
Files 12 12
Lines 1179 1179
=======================================
Hits 1147 1147
Misses 32 32 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Comparing Footnotes
|



Summary
test_default_signoff_skips_ignored_authordid not mockget_git_config_value, which makes it environment-dependent and fail on any machine where the developer has a localgit config user.nameset.Root cause
Author resolution (
_resolve_current_author) readsgit config user.namefirst when validating a prospective message (stdin). The test only mockedget_commit_info(returning the ignored bot author), so with a realuser.nameconfigured, resolution returned the developer's name instead ofdependabot[bot]— the author was not recognized as ignored, the signoff check ran, and the test failed. It only passed in environments whereuser.namehappened to be unset (e.g. CI).Fix
Mock
get_git_config_valueto return an empty string so author resolution deterministically falls back to the commit author (get_commit_info("an")), matching the test's intent. No production code changes.Verification
user.namesetting.Generated by Claude Code
Summary by CodeRabbit