Commit ad87cfa
fix: add HTTP readiness check to wait_for_server and remove dead code (#1777)
The flaky SSE tests (test_sse_client_basic_connection_mounted_app,
test_request_context_isolation) fail intermittently because
wait_for_server() only checks TCP port connectivity. On slow CI
machines, the port may accept connections before the ASGI app is
fully initialized, causing SSE requests to fail.
- Add a two-stage readiness check to wait_for_server(): first TCP
connect, then an actual HTTP request to verify the app is handling
requests (any HTTP response, even 404, confirms readiness)
- Remove unreachable dead code after blocking server.run() calls in
run_server() and run_mounted_server()
- Remove unused `time` import from test_sse.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2fe56e5 commit ad87cfa
2 files changed
+31
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 136 | | |
143 | 137 | | |
144 | 138 | | |
| |||
313 | 307 | | |
314 | 308 | | |
315 | 309 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | 310 | | |
322 | 311 | | |
323 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
11 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
15 | | - | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | | - | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | | - | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments