Conversation
Removed `async def` and `@pytest.mark.asyncio` from synchronous `TestClient` tests in `test_new_detectors.py`, `test_detection_bytes.py`, and `test_severity.py`. Added missing `/api/` prefix to test endpoints for vandalism, infrastructure, waste, civic-eye, transcribe-audio, and severity to match modular router configuration in `main.py` and fix 404s.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
✅ Deploy Preview for fixmybharat canceled.
|
🙏 Thank you for your contribution, @RohanExploit!PR Details:
Quality Checklist:
Review Process:
Note: The maintainers will monitor code quality and ensure the overall project flow isn't broken. |
📝 WalkthroughWalkthroughFour backend test files are updated to convert async test functions to synchronous versions and standardize API endpoint paths to use the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Pull request overview
Adjusts backend tests to match the FastAPI app’s /api router mounting and to use synchronous TestClient patterns (removing unnecessary async test markers).
Changes:
- Removed
async def+pytest.mark.asynciofrom tests that only use synchronousTestClientrequests. - Updated affected test requests to include the missing
/api/prefix for detection/transcription endpoints. - Kept existing mocking patterns while aligning route paths with
backend/main.pyrouter prefixes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/tests/test_new_detectors.py | Converts tests to sync style (no pytest.mark.asyncio) while keeping TestClient usage. |
| backend/tests/test_detection_bytes.py | Converts tests to sync style and fixes detection endpoint paths to /api/*. |
| backend/tests/test_severity.py | Converts to sync test function and fixes severity endpoint path to /api/detect-severity. |
| backend/tests/test_new_features.py | Fixes feature endpoint paths to /api/* (waste, civic-eye, transcribe-audio). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
backend/tests/test_new_detectors.pyto removeasync defandpytest.mark.asynciofrom synchronous TestClient requests.backend/tests/test_detection_bytes.pysimilarly and added missing/api/prefixes.backend/tests/test_severity.pysimilarly and added missing/api/prefix.backend/tests/test_new_features.pyto include the missing/api/prefix for/detect-waste,/detect-civic-eye, and/transcribe-audio.PR created automatically by Jules for task 482903977578798018 started by @RohanExploit
Summary by cubic
Fixes the test suite by removing unnecessary async markers and updating routes to the correct
/api/*paths. This prevents 404s and event loop issues, restoring passing tests for detection and severity endpoints.async defand@pytest.mark.asynciofromTestClient-based tests inbackend/tests/test_new_detectors.py,backend/tests/test_detection_bytes.py, andbackend/tests/test_severity.py./api/prefix for/detect-vandalism,/detect-infrastructure,/detect-waste,/detect-civic-eye,/transcribe-audio, and/detect-severityin tests to match router mounts inmain.py.Written for commit 2744219. Summary will update on new commits.
Summary by CodeRabbit
Tests
/api/path structureChores