test(metrics): add coverage for metrics timing decorator#1003
test(metrics): add coverage for metrics timing decorator#1003mnadzam wants to merge 1 commit intopython-wheel-build:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds tests/tests_metrics.py (new) which provides pytest coverage for fromager.metrics. It defines several functions decorated with Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/test_metrics.py`:
- Around line 128-144: Add a new unit test in tests/test_metrics.py that calls
metrics._extract_version_from_return(None) and asserts it returns None to cover
the acceptance criterion for issue `#978`; ensure the test function name is unique
(e.g., test_extract_version_none) and follows the same style as the other tests
so it runs with the existing test suite and exercises the code path where
iterating over None would raise a TypeError.
- Around line 31-37: The helper function _test_raises used under the
metrics.timeit decorator must accept a version parameter so the decorator's
storage path (which only runs when both req and version are present) can be
exercised; update the _test_raises signature to include version: str | None =
None (or the project's Version type if different) and ensure the function
accepts and ignores this parameter while still raising the RuntimeError so the
test can pass a version and verify that exceptions prevent storage.
🪄 Autofix (Beta)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5f0dfdb8-5fec-4664-9c4e-b7c1d569f8bc
📒 Files selected for processing (1)
tests/test_metrics.py
Closes python-wheel-build#978 Signed-off-by: Marcel Nadzam <mnadzam@redhat.com> Co-Authored-By: Cursor
Closes #978