Commit 9c0d31f
committed
test: replace multiprocessing with threading for server test coverage
Replace multiprocessing.Process with threading.Thread + uvicorn.Server
for test server fixtures (basic_server, json_server, resumable_server)
so coverage.py can track server-side code in the same process.
Changes:
- Add _start_server_thread() helper using uvicorn.Server in a daemon thread
- Graceful shutdown via server.should_exit instead of proc.kill()
- Remove 8 pragma: no cover from test fixtures (no longer needed)
- Add 8 new tests covering previously-uncovered branches
- Remove dead run_server() function and unused http_client fixture
- Convert pragma: no cover to pragma: lax no cover in source files
for non-deterministic coverage lines (thread timing dependent)
- Add pragma: no branch for partial branch coverage on guard lines1 parent 7ba4fb8 commit 9c0d31f
File tree
4 files changed
+334
-173
lines changed- src/mcp/server
4 files changed
+334
-173
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| |||
222 | 224 | | |
223 | 225 | | |
224 | 226 | | |
225 | | - | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| |||
446 | 448 | | |
447 | 449 | | |
448 | 450 | | |
449 | | - | |
| 451 | + | |
450 | 452 | | |
451 | | - | |
| 453 | + | |
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
| |||
478 | 480 | | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
| 483 | + | |
482 | 484 | | |
483 | | - | |
| 485 | + | |
484 | 486 | | |
485 | | - | |
| 487 | + | |
486 | 488 | | |
487 | | - | |
| 489 | + | |
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
| |||
0 commit comments