Fix Testing Suites & Async Execution Issues#589
Conversation
|
👋 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. |
📝 WalkthroughWalkthroughTest files are being refactored to convert async test functions to synchronous variants and update API endpoints to use a standardized Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ 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
This PR aims to stabilize the backend test suite by aligning tests with how FastAPI’s synchronous TestClient executes async endpoints, and by correcting test URLs to match the app’s /api router prefix.
Changes:
- Converted several tests from
async def/@pytest.mark.asyncioto synchronous tests usingTestClient. - Updated multiple detection endpoint test calls to use the
/api/...URL prefix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/tests/test_severity.py | Removes asyncio test marker/async test function; updates endpoint path to /api/detect-severity. |
| backend/tests/test_new_features.py | Updates tested detection/transcription endpoint paths to /api/.... |
| backend/tests/test_new_detectors.py | Removes asyncio test markers/async test functions for detector endpoint tests. |
| backend/tests/test_detection_bytes.py | Removes asyncio test markers/async test functions; updates endpoint paths to /api/.... |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This submission resolves multiple issues across the testing suites in both the backend and frontend:
async defand@pytest.mark.asynciousages in synchronousTestClienttests, which caused tests to fail natively.pytest-asyncioand configuredpytest.iniwithasyncio_mode = autoandasyncio_default_fixture_loop_scope = functionto gracefully handle backend asynchronous test setups and fixtures without throwing deprecation warnings./detect-waste,/detect-vandalism,/detect-severity) to point to the correct global/api/prefix as defined inbackend/main.py.babel-plugin-transform-vite-meta-env,ts-jest,@types/jest) to allow frontend test files with Vite'simport.meta.envto parse and pass without module resolution errors.PR created automatically by Jules for task 3169809748811227243 started by @RohanExploit
Summary by cubic
Fixes failing backend tests and frontend Jest runs by correcting async usage, aligning test routes to the
/api/*prefix, and adding required test configs. Restores green CI and removes asyncio warnings.Bug Fixes
@pytest.mark.asynciotests to sync forTestClient./api/detect-*and/api/transcribe-audio.Dependencies
pytest-asyncioand configuredpytest.inifor auto asyncio mode.babel-plugin-transform-vite-meta-env,ts-jest, and@types/jestto let Jest parseimport.meta.envand TypeScript.Written for commit c051edf. Summary will update on new commits.
Summary by CodeRabbit
/apipath prefix across all backend API endpoints.