-
Notifications
You must be signed in to change notification settings - Fork 64
LCORE-1071: better comments in unit tests #874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-1071: better comments in unit tests #874
Conversation
|
Warning Rate limit exceeded@tisnik has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 17 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughAll changes are confined to test files. Updates include adding comprehensive docstrings to helper functions and expanding test mock initialization with additional attributes to cover more test assertions without altering runtime control flow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/unit/app/endpoints/test_query_v2.py (1)
477-488: Align docstring/annotation with always‑raising helperThe docstring nicely explains that this helper always raises
APIConnectionErrorwith aRequest, matching how it’s used in the test. One small nit: the function is annotated as-> Exceptionbut the docstring’s “Returns: None” section suggests a normal return path, even though it never returns.Consider either:
- Dropping the “Returns” section and stating explicitly that the function always raises, or
- Changing the return annotation to
-> Noneor-> NoReturnto match the behavior.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
tests/unit/app/endpoints/test_query_v2.py(1 hunks)tests/unit/app/endpoints/test_rags.py(1 hunks)tests/unit/authorization/test_middleware.py(2 hunks)tests/unit/utils/test_llama_stack_version.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
tests/{unit,integration}/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests; do not use unittest framework
Unit tests must achieve 60% code coverage; integration tests must achieve 10% coverage
Files:
tests/unit/utils/test_llama_stack_version.pytests/unit/authorization/test_middleware.pytests/unit/app/endpoints/test_query_v2.pytests/unit/app/endpoints/test_rags.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use
pytest-mockwith AsyncMock objects for mocking in tests
Files:
tests/unit/utils/test_llama_stack_version.pytests/unit/authorization/test_middleware.pytests/unit/app/endpoints/test_query_v2.pytests/unit/app/endpoints/test_rags.py
🧠 Learnings (1)
📚 Learning: 2025-11-24T16:58:04.410Z
Learnt from: CR
Repo: lightspeed-core/lightspeed-stack PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:58:04.410Z
Learning: Applies to src/**/{client,app/endpoints/**}.py : Handle `APIConnectionError` from Llama Stack in integration code
Applied to files:
tests/unit/app/endpoints/test_query_v2.py
🪛 GitHub Actions: Python linter
tests/unit/utils/test_llama_stack_version.py
[error] 85-85: pylint failed during 'uv run pylint src tests': Line too long (116/100) (C0301).
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-pr
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
- GitHub Check: E2E: library mode / ci
- GitHub Check: E2E: library mode / azure
- GitHub Check: E2E: server mode / ci
- GitHub Check: E2E: server mode / azure
🔇 Additional comments (3)
tests/unit/authorization/test_middleware.py (2)
279-285: Inner endpoint docstring is clear and consistentThe added docstring succinctly documents the mock endpoint’s purpose, arguments, and return value; no changes needed.
302-308: Second mock endpoint docstring matches behavior and usageThis docstring mirrors the pattern from the success case and accurately describes the mocked failure endpoint. Looks good as-is.
tests/unit/app/endpoints/test_rags.py (1)
193-203: Expanded RagInfo mock docstring accurately documents fieldsThe added
__init__docstring clearly describes all predefined attributes and matches the assignments below, improving test readability without affecting behavior.
cee6883 to
838b9ac
Compare
Description
LCORE-1071: better comments in unit tests
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.