Commit 5a706cb
test: fix flaky mqtt adapter tests using asyncio events
The `tests/unit/test_standalone/test_mqtt_adapter.py` test suite used `await asyncio.sleep(0.02)` to wait for mocked methods to be called before assertions. Under higher load, or in some configurations, this constant delay was insufficient, causing intermittent failures such as `AssertionError: Expected 'publish_log' to have been called`. This replaces the arbitrary sleeps with deterministic synchronization primitives (`asyncio.Event`) where tests wait explicitly for the mocked function to be called before checking assertions.
This commit includes both the code fixes and the `black` formatting applied.
Co-authored-by: rnovatorov <[email protected]>1 parent ab1804f commit 5a706cb
0 file changed
0 commit comments