Improve test resiliance

This commit is contained in:
Matthias 2022-10-02 08:12:03 +02:00
parent 2c94ed2e59
commit 564318415e

View File

@ -207,12 +207,15 @@ async def test_emc_create_connection_invalid_port(default_conf, caplog, mocker):
}) })
dp = DataProvider(default_conf, None, None, None) dp = DataProvider(default_conf, None, None, None)
# Handle start explicitly to avoid messing with threading in tests
mocker.patch("freqtrade.rpc.external_message_consumer.ExternalMessageConsumer.start",)
emc = ExternalMessageConsumer(default_conf, dp) emc = ExternalMessageConsumer(default_conf, dp)
try: try:
await asyncio.sleep(0.01) await emc._create_connection(emc.producers[0], asyncio.Lock())
assert log_has_re(r".+ is an invalid WebSocket URL .+", caplog) assert log_has_re(r".+ is an invalid WebSocket URL .+", caplog)
finally: finally:
emc._running = False
emc.shutdown() emc.shutdown()