Skip to content

Commit a29f645

Browse files
committed
fix(tests): make unmatched-id log test work on pytest < 9
The pyflowlauncher logger disables propagation (records go to plugin.log), and caplog before pytest 9 only captures propagated records, so the assertion failed on CI's 3.8/3.9 jobs. Re-enable propagation for the test via monkeypatch. Claude-Session: https://claude.ai/code/session_0187j4hp3ndjDPLJy9kdHXnr
1 parent c50a56d commit a29f645

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/unit/test_jsonrpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ async def _run():
147147
asyncio.run(_run())
148148

149149

150-
def test_v2_unmatched_response_id_logs_warning(caplog):
150+
def test_v2_unmatched_response_id_logs_warning(caplog, monkeypatch):
151151
"""Responses with an unknown id must be logged, not silently dropped."""
152+
# base.py disables propagation on the package logger (records go to
153+
# plugin.log); pytest < 9 caplog only sees propagated records.
154+
monkeypatch.setattr(logging.getLogger('pyflowlauncher'), 'propagate', True)
152155
with caplog.at_level(logging.WARNING, logger='pyflowlauncher.jsonrpc'):
153156
msgs = _collect_messages('{"id": 7, "result": {}}\n')
154157
assert msgs == []

0 commit comments

Comments
 (0)