Commit fe72545
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 fe72545
File tree
4 files changed
+309
-152
lines changed- src/mcp/server
4 files changed
+309
-152
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
| 481 | + | |
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| |||
0 commit comments