From b3d775f0d6777a40f0244079cae54531f3c369cb Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 27 Jun 2021 00:47:35 +0200 Subject: [PATCH] getMessages: Raise an error when forgetting to synchronize=False Instead of hanging forever. Hopefully there shouldn't be any false positive. --- irctest/client_mock.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/irctest/client_mock.py b/irctest/client_mock.py index 1fefb16..e6aaa13 100644 --- a/irctest/client_mock.py +++ b/irctest/client_mock.py @@ -88,6 +88,14 @@ class ClientMock: message = message_parser.parse_message(line) if message.command == "PONG" and token in message.params: got_pong = True + elif ( + synchronize + and message.command == "451" + and message.params[1] == "PING" + ): + raise ValueError( + "Got '451 * PONG'. Did you forget synchronize=False?" + ) else: if raw: messages.append(line) # type: ignore