test: ignore a failure to send a pong

Our automatic pong handler unconditionally sends a Pong back to the EIS
implementation. For some tests and depending on timing we may have
been disconnected already, resulting in a BrokenPipeError that fails
us the test. Ignore that error.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/317>
This commit is contained in:
Peter Hutterer 2024-12-06 16:32:29 +10:00
parent 96f20ae333
commit 60bc264e75

View file

@ -287,7 +287,10 @@ class Ei:
# Automatic ping/pong handler
def ping(conn, id, version, new_objects={}):
pingpong = new_objects["ping"]
ei.send(pingpong.Done(0))
try:
ei.send(pingpong.Done(0))
except BrokenPipeError:
pass
ei.connection.connect("Ping", ping)