mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 02:05:11 +08:00
fix: resolve race condition in test_component_logging for Python 3.13 (#12676)
Replace queue.get_nowait() with asyncio.wait_for(queue.get(), timeout=5.0) to properly wait for async events in the queue, preventing QueueEmpty errors in Python 3.13. Fixes flaky test failure in release workflow.
This commit is contained in:
@ -200,8 +200,12 @@ async def test_component_logging():
|
||||
# Log a message
|
||||
await asyncio.to_thread(component.log, "Test log message")
|
||||
|
||||
# Get the event from the queue
|
||||
event_id, event_data, _ = queue.get_nowait()
|
||||
# Get the event from the queue with timeout to avoid race conditions
|
||||
try:
|
||||
event_id, event_data, _ = await asyncio.wait_for(queue.get(), timeout=5.0)
|
||||
except asyncio.TimeoutError:
|
||||
pytest.fail("Timeout waiting for log event in queue")
|
||||
|
||||
event = event_data.decode("utf-8")
|
||||
|
||||
assert "Test log message" in event
|
||||
|
||||
Reference in New Issue
Block a user