Skip to content

Commit 9ccdfbc

Browse files
committed
test(dispatcher): exercise notification failure handler
1 parent 6922ff5 commit 9ccdfbc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/shared/test_dispatcher.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,18 @@ async def on_progress(progress: float, total: float | None, message: str | None)
235235

236236
@pytest.mark.anyio
237237
async def test_notification_handler_exception_does_not_reach_sender(pair_factory: PairFactory):
238+
called = anyio.Event()
239+
238240
async def on_notify(
239241
ctx: DispatchContext[TransportContext], method: str, params: Mapping[str, Any] | None
240242
) -> None:
243+
called.set()
241244
raise RuntimeError("handler failed")
242245

243-
async with running_pair(pair_factory, client_on_notify=on_notify) as (client, *_):
246+
async with running_pair(pair_factory, server_on_notify=on_notify) as (client, *_):
244247
with anyio.fail_after(5):
245248
await client.notify("notifications/message", None)
249+
await called.wait()
246250

247251

248252
@pytest.mark.anyio

0 commit comments

Comments
 (0)