test: fix a spuriously failing timeout

When running repeated tests in parallel, this one eventually fails
because the ei.send() doesn't trigger the expected BrokenPipeError.
Use ei.dispatch() instaed and check whether the connection still exists.

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

View file

@ -896,8 +896,15 @@ class TestEiProtocol:
ei.dispatch()
assert not status.connected
assert not status.disconnected # we never get the Disconnected event
ei.send(bytes(16))
assert False, "We should've been disconnected by now"
# Might take a while but eventually we should get disconnected...
for _ in range(10):
if ei.connection is None:
return
time.sleep(0.1)
ei.dispatch()
else:
assert False, "We should've been disconnected by now"
ei.wait_for(lambda: status.connected)
if missing_interface in [InterfaceName.EI_DEVICE, InterfaceName.EI_SEAT]: