getMessages: Raise an error when forgetting to synchronize=False

Instead of hanging forever.

Hopefully there shouldn't be any false positive.
This commit is contained in:
Valentin Lorentz 2021-06-27 00:47:35 +02:00 committed by Val Lorentz
parent cc8b9748a7
commit b3d775f0d6

View File

@ -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