Commit e045ebb
committed
Consolidate stdio tests: in-process logic tests, minimal real-process set
The stdio client's logic — framing, parse errors, the shutdown
escalation decisions — is now tested in process against a fake process
injected through the spawn seam, and only the properties that are OS
behaviour keep real subprocesses. The in-process tests include
regressions for the shutdown bugs fixed in the previous commit:
cancellation must still run the full shutdown, tree kill must reach
children after the leader has exited, writes racing server death must
surface clean closure, exiting with a server message still undelivered
must be a clean exit, and a server exiting on stdin close must never
be terminated. Each was verified to fail against the previous
implementation.
The real-process set shrinks to: one consolidated tree-kill test driven
through the public stdio_client (a parent that exits instantly on
SIGTERM, a child, and a grandchild — pinning group inheritance, atomic
group kill, and dead-leader robustness in one spawn), the
SIGTERM-ignoring SIGKILL escalation test, a dead-group no-op test, and
exec-failure ENOENT. Grace and kill timeouts are shortened via
monkeypatch in the real tests: the escalation decision is pinned in
process against a shortened grace, the SIGTERM-then-SIGKILL escalation
itself is exercised only by the real escalation test, and the
production constants' values are deliberately unpinned. The stdio
surface drops from ~11s to ~3.5s.
Deleted as subsumed or broken:
- The two tee-based tests: the interaction suite's subprocess e2e pins
the real-pipe round trip with a real server, and tee could never
deterministically exercise the chunk-reassembly buffer that the new
in-process framing test pins (real pipes deliver short messages as
whole lines).
- test_stdio_client_bad_path: its script only "failed" because
non-existent-file.py happens to be a Python expression that raises
NameError; the property (stdout EOF fails initialize with
CONNECTION_CLOSED) is now pinned in process.
- The basic/early-parent cleanup tests and universal-cleanup /
graceful-stdin-exit tests, folded into the consolidated tree test and
the in-process graceful/escalation tests.
- tests/issues/test_1027_win_unreachable_cleanup.py: its lifespan
cleanup chain is covered by the interaction e2e's clean-exit marker
plus the lifespan tests, it polled marker files with fixed sleeps,
and it leaked its child process when an assertion failed mid-test.
Its only helper module (tests/shared/test_win32_utils.py) goes with
it. The MCPServer.run("stdio") coverage its subprocess scripts
provided is replaced by an in-process test that drives run() over
injected stdio and asserts a real response.
tests/issues/test_552_windows_hang.py now asserts initialize succeeded
instead of swallowing every exception (its handcrafted response also
sent the invalid protocolVersion "1.0", so it errored on every run and
passed anyway), the stdio server tests are bounded by fail_after, and
the elicitation tests that claimed "stdio" in their names run, and now
say they run, over the in-memory transport.1 parent ddb8ef8 commit e045ebb
7 files changed
Lines changed: 539 additions & 610 deletions
File tree
- tests
- client
- interaction/transports
- issues
- server
- mcpserver
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
22 | | - | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | | - | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
53 | | - | |
54 | 49 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments