You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Replace arbitrary sleeps with active server readiness checks in tests
Eliminates race conditions in HTTP server tests by replacing fixed sleep delays
with deterministic server readiness polling. This makes tests more reliable and
often faster by eliminating unnecessary waits.
Changes:
- Created shared wait_for_server() helper in tests/test_helpers.py
- Fixed flaky time.sleep(1) in test_streamable_http_security.py
- Replaced duplicate wait_for_server() in test_sse_security.py with shared helper
- Improved consistency by updating all HTTP server test fixtures in:
- tests/shared/test_ws.py
- tests/shared/test_sse.py
- tests/shared/test_streamable_http.py
The wait_for_server() helper:
- Actively polls the server port by attempting TCP connections
- Returns immediately when the server accepts connections
- Uses 0.01-second intervals between attempts
- Has a 5-second timeout that raises TimeoutError on true failures
- Makes tests deterministic instead of probabilistic
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments