File tree Expand file tree Collapse file tree
universal-telemetry-software Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ cantools>=39.4.0
99# Test dependencies
1010pytest >= 7.4.0
1111pytest-asyncio >= 0.21.0
12+ pytest-timeout >= 2.1.0
1213requests >= 2.31.0
1314
1415PyGObject
Original file line number Diff line number Diff line change @@ -369,13 +369,13 @@ def handle_error(error):
369369 logger .info (f" { msg } " )
370370
371371 # Check for WebSocket connection
372- connection_logs = [msg for msg in console_messages if "WebSocket connected " in msg ]
372+ connection_logs = [msg for msg in console_messages if "[ WebSocket] Connected " in msg ]
373373 assert len (connection_logs ) > 0 , \
374374 f"WebSocket connection not established. Errors: { page_errors } . Console: { console_messages [:15 ]} "
375375 logger .info ("✓ Pecan established WebSocket connection" )
376-
376+
377377 # Check for data reception (should see at least first message)
378- data_logs = [msg for msg in console_messages if "Received WebSocket message #" in msg ]
378+ data_logs = [msg for msg in console_messages if "[ WebSocket] Message #" in msg ]
379379 assert len (data_logs ) > 0 , \
380380 f"No WebSocket messages received. Console: { console_messages [:15 ]} "
381381 logger .info (f"✓ Pecan received { len (data_logs )} WebSocket messages" )
Original file line number Diff line number Diff line change @@ -62,7 +62,16 @@ async def test_ping_returns_pong(self):
6262 await ws .connect ()
6363 ts = int (time .time () * 1000 )
6464 await ws .send_message ({"type" : "ping" , "timestamp" : ts })
65- msg = await ws .receive_message (timeout = 5 )
65+
66+ # Server may send CAN batch frames before the pong — skip non-dict messages
67+ msg = None
68+ for _ in range (10 ):
69+ candidate = await ws .receive_message (timeout = 5 )
70+ if candidate is None :
71+ break
72+ if isinstance (candidate , dict ) and candidate .get ("type" ) == "pong" :
73+ msg = candidate
74+ break
6675
6776 assert msg is not None , "No pong response received"
6877 assert msg ["type" ] == "pong"
You can’t perform that action at this time.
0 commit comments