Repository navigation
Conversation
WalkthroughThe unit tests for the Changes
Estimated code review effort1 (~2 minutes) Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/unit/app/endpoints/test_feedback.py (1)
107-107: Consider extending the patching approach to other tests for consistency.While the main objective of this PR has been achieved, there are still other tests in this file that directly modify global configuration values (lines 107 and 138). For better test isolation and consistency, consider applying the same patching approach to these tests as well.
For example,
test_store_feedbackcould use:with patch("app.endpoints.feedback.configuration.user_data_collection_configuration.feedback_storage", "fake-path"):And
test_feedback_statuscould use:with patch("app.endpoints.feedback.configuration.user_data_collection_configuration.feedback_enabled", True):Also applies to: 138-138
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/unit/app/endpoints/test_feedback.py(2 hunks)
🧬 Code Graph Analysis (1)
tests/unit/app/endpoints/test_feedback.py (1)
src/app/endpoints/feedback.py (1)
is_feedback_enabled(41-47)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/unit/app/endpoints/test_feedback.py (1)
src/app/endpoints/feedback.py (1)
is_feedback_enabled(41-47)
🔇 Additional comments (3)
tests/unit/app/endpoints/test_feedback.py (3)
3-3: LGTM: Import addition is correct and necessary.The import of
patchfromunittest.mockis properly added to support the refactored test methods.
20-24: Excellent refactoring: Improved test isolation with proper patching.The use of
patchcontext manager instead of direct global config modification is a significant improvement. This ensures the original configuration is automatically restored after the test, preventing side effects on other tests.
29-33: LGTM: Consistent implementation with the enabled test.The patching approach is correctly applied here as well, maintaining consistency with the
test_is_feedback_enabledfunction while testing the opposite scenario.
|
/retest |
|
@matysek anything we should worry about ^? It seems to be related with the new Python image |
|
I think the error was in my other PR too, but was fixed by retest after I pushed some changes there. Can you try to hit the retest? It seems I don't have that option. |
There was a problem hiding this comment.
The error in the CI seems unrelated:
Error: creating build container: initializing source docker://registry.access.redhat.com/ubi9/python-312-minimal:latest: reading manifest latest in registry.access.redhat.com/ubi9/python-312-minimal: received unexpected HTTP status: 500 Internal Server Error
umago
left a comment
There was a problem hiding this comment.
Actually, fat fingered the approve. I think we should use pytest instead of the built-in module for consistency
| @@ -1,5 +1,7 @@ | |||
| """Unit tests for the /feedback REST API endpoint.""" | |||
|
|
|||
| from unittest.mock import patch | |||
| @@ -15,14 +17,20 @@ | |||
|
|
|||
| def test_is_feedback_enabled(): | |||
There was a problem hiding this comment.
def test_is_feedback_enabled(mocker):
...
with mocker.patch(....
| assert is_feedback_enabled() is True, "Feedback should be enabled" | ||
|
|
||
|
|
||
| def test_is_feedback_disabled(): |
There was a problem hiding this comment.
ditto, let's use mocker instead of built-in mock since we already use pytest
|
/retest |
…ile fixes Moves the lock from 6bf22a3d to 37a08409, which adds upstream PRs lightspeed-core#276 (exec output handling), lightspeed-core#277 (MCP secret-file helper over exec stdin) and lightspeed-core#278 (startup reconcile destroys only expired sandboxes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Description
Use patches in test_is_feedback_enabled and test_is_feedback_disabled to not modify global config value.
Type of change
Related Tickets & Documents
https://issues.redhat.com/browse/LCORE-175
Checklist before requesting a review
Testing
Summary by CodeRabbit