Skip to content

Commit e56de3c

Browse files
committed
test: convert test_integration.py to in-memory transport
The file previously spun up a uvicorn subprocess + TCP port for each of 20 parametrized tests (10 tests × 2 transports). This caused flaky CI failures from port races under pytest-xdist: the `server_port` fixture releases its socket before the subprocess binds, so another xdist worker can grab the same port first. `wait_for_server` only checks for TCP connect, so it happily accepts a connection to the WRONG server. None of these tests exercise transport-specific behavior — they test MCP protocol features (tools, resources, prompts, progress, sampling, elicitation, notifications, completion, structured output). The transport parametrization doubled test time without adding coverage; transport behavior is tested separately in tests/server/test_sse_security.py, test_streamable_http_{manager,security}.py, and tests/shared/. Converted all tests to use `Client(mcp)` in-memory, matching the established pattern in test_server.py and test_url_elicitation.py. Impact: - Eliminates port race flakiness for this file - 20 tests → 10 tests (no transport parametrization) - ~20s subprocess spawn overhead → 0.5s total - -284 lines (deleted subprocess/fixture infrastructure) Github-Issue: #1776
1 parent 62eb08e commit e56de3c

File tree

1 file changed

+230
-514
lines changed

1 file changed

+230
-514
lines changed

0 commit comments

Comments
 (0)