Commit b6b1850
fix(tests): make integration tests pass on macOS (#1091)
* fix(tests): make integration tests pass on macOS
On macOS with KqueueSelector, `asyncio.open_connection` returns before
the server-side accept callback registers the connection in
`ctx.connections`. Three tests in test_servercontext.py raced this
scheduling difference and failed deterministically on macOS while
passing on Linux CI.
- test_unexpected_exception: yield via exhaust_callbacks so the server
task emits the "Exception in protocol" log before caplog is checked.
- test_drain_connections / test_connection_broken_external: poll
ctx.connections until populated before depending on it. exhaust_callbacks
cannot be used inside @fast_forward — the outer ticker keeps
rescheduling itself and the inner exhaust never exits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(tests): wait for queue boundary in test_info_message
`matchmaker_info` is broadcast by the periodic `report_dirties` ticker.
On macOS the first broadcast after `game_matchmaking` could be the
startup one (queue dirty but no searcher → empty boundary), making the
[[300, 700]] assertion fail. Wait for a matchmaker_info where the
tmm2v2 queue actually carries a non-empty boundary before asserting.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(tests): bound the connection-registration wait
Address CodeRabbit feedback: replace `while not ctx.connections` spin
loops with a helper that polls up to a fixed iteration count and raises
AssertionError on exhaustion, so tests fail fast instead of hanging if
the server never registers the connection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3c500c0 commit b6b1850
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
| |||
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| 104 | + | |
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| |||
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
| |||
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| 159 | + | |
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| |||
0 commit comments