-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
PR #596 added two actionable hint messages to main.py when --clear-cache is invoked but no cache file exists:
# main.py ~line 2607-2609
else:
print(f"... ℹ No cache file found, nothing to clear ...")
print(f"... 💡 Hint: The cache file will be created or updated after a successful sync run without --dry-run ...")Neither message is covered by any existing test. The current test_clear_cache_deletes_file in tests/test_disk_cache.py only covers the file-exists path (file is deleted successfully), leaving the no-file branch completely untested.
Suggested Changes
Add a new test to tests/test_disk_cache.py (or a suitable file) that:
- Patches
cache.get_cache_dirto point at a temp directory with noblocklists.json - Invokes the
--clear-cachebranch logic (or callsmain.main()with patchedsys.argv) - Captures
stdoutwithio.StringIOorcapsys - Asserts both messages appear:
"No cache file found, nothing to clear""The cache file will be created or updated after a successful sync run without --dry-run"
Files Affected
tests/test_disk_cache.py— addtest_clear_cache_no_file_shows_hint()test
Success Criteria
- ✅ New test exercises the
elsebranch atmain.py~line 2607 - ✅ Both hint messages are asserted in captured output
- ✅ Test works in both colour (
USE_COLORS=True) and no-colour modes (strip ANSI if needed) - ✅ All existing tests pass:
uv run pytest tests/ -v
Source
Identified during task mining run §22795900937 from discussion #602 (Mar 7 QA report, PR #596 change log). The test_clear_cache_deletes_file test in test_disk_cache.py only covers the success path; the no-file hint path from PR #596 remains untested.
Priority
Low — Small, self-contained test. Completes coverage for the empty-state UX improvements from PR #596.
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent
To install this agentic workflow, run
gh aw add github/gh-aw/.github/workflows/discussion-task-miner.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4
- expires on Mar 8, 2026, 9:00 AM UTC