Add sleep to allow thread to start

This commit is contained in:
Matthias 2019-11-12 13:14:43 +01:00
parent 7a2d917c66
commit 136ef077b2

View File

@ -1,5 +1,5 @@
# pragma pylint: disable=missing-docstring, C0103 # pragma pylint: disable=missing-docstring, C0103
import time
import logging import logging
from unittest.mock import MagicMock from unittest.mock import MagicMock
@ -176,6 +176,8 @@ def test_init_apiserver_enabled(mocker, default_conf, caplog) -> None:
"listen_port": "8080"} "listen_port": "8080"}
rpc_manager = RPCManager(get_patched_freqtradebot(mocker, default_conf)) rpc_manager = RPCManager(get_patched_freqtradebot(mocker, default_conf))
# Sleep to allow the thread to start
time.sleep(0.5)
assert log_has('Enabling rpc.api_server', caplog) assert log_has('Enabling rpc.api_server', caplog)
assert len(rpc_manager.registered_modules) == 1 assert len(rpc_manager.registered_modules) == 1
assert 'apiserver' in [mod.name for mod in rpc_manager.registered_modules] assert 'apiserver' in [mod.name for mod in rpc_manager.registered_modules]