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:
vjgit96
2026-04-13 18:28:04 -04:00
committed by GitHub
parent 4be5f7f52f
commit 42e84d0fdf

View File

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