test: cover git cache edge cases without network - #277
Conversation
Closes #267 Empty cache dir, corrupt metadata, invalid refresh-hours env, and refresh-mode decision matrix for CacheMeta.
|
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)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pull request adds unit tests for missing and corrupt cache metadata, invalid refresh interval configuration, and refresh decisions across supported modes. ChangesGit cache test coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/create-python-app-core/tests/test_git_cache.py`:
- Around line 146-155: Update test_read_cache_meta_corrupt_json to restrict
pytest.raises to json.JSONDecodeError and CpaError, removing the generic
TypeError and ValueError alternatives while preserving the corrupt-JSON fixture
and read_cache_meta call.
- Around line 140-143: Update test_read_cache_meta_empty_dir to create an
existing empty cache directory under tmp_path and assert read_cache_meta returns
None for it, while retaining a separate assertion that a nonexistent path also
returns None.
- Around line 165-173: Add an assertion in test_should_refresh_modes for the
fresh meta instance with "stale" mode, verifying _should_refresh returns False;
retain the existing stale-metadata assertion that returns True.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 52bd2949-1482-4533-ab27-638920fdd45b
📒 Files selected for processing (1)
packages/create-python-app-core/tests/test_git_cache.py
|
@AshSgDe29071999 hey! thanks for your contribution here! CodeRabbit just left some review comments. Please address those and I'll run the CI and check after that 😊 You can also join the community Discord for quick questions and coordination: Discord 🥳 |
Cover empty existing cache dirs separately from missing paths, narrow corrupt-JSON exceptions to JSONDecodeError/CpaError, and assert fresh metadata does not refresh under stale mode.
|
Addressed the CodeRabbit review comments on
Ready for another look whenever you have a chance. |
|
@ulises-jeremias — CodeRabbit’s three review notes on
Ready for CI whenever you have a moment. Thanks! |
Summary
Cache helpers needed more edge-case coverage without network access.
Changes
.cpa-cache.jsonraises cleanlyCPA_REFRESH_AFTER_HOURSfalls back to 24h_should_refreshmode matrixCloses #267
Summary by CodeRabbit