Move async_mock into conditional

This commit is contained in:
Matthias 2024-06-04 19:01:21 +02:00
parent a2251d045c
commit 7c6a5a34f5

View File

@ -238,7 +238,6 @@ def patched_configuration_load_config_file(mocker, config) -> None:
def patch_exchange( def patch_exchange(
mocker, api_mock=None, id="binance", mock_markets=True, mock_supported_modes=True mocker, api_mock=None, id="binance", mock_markets=True, mock_supported_modes=True
) -> None: ) -> None:
mocker.patch(f"{EXMS}._load_async_markets", return_value={})
mocker.patch(f"{EXMS}.validate_config", MagicMock()) mocker.patch(f"{EXMS}.validate_config", MagicMock())
mocker.patch(f"{EXMS}.validate_timeframes", MagicMock()) mocker.patch(f"{EXMS}.validate_timeframes", MagicMock())
mocker.patch(f"{EXMS}.id", PropertyMock(return_value=id)) mocker.patch(f"{EXMS}.id", PropertyMock(return_value=id))
@ -248,6 +247,7 @@ def patch_exchange(
mocker.patch("freqtrade.exchange.bybit.Bybit.cache_leverage_tiers") mocker.patch("freqtrade.exchange.bybit.Bybit.cache_leverage_tiers")
if mock_markets: if mock_markets:
mocker.patch(f"{EXMS}._load_async_markets", return_value={})
if isinstance(mock_markets, bool): if isinstance(mock_markets, bool):
mock_markets = get_markets() mock_markets = get_markets()
mocker.patch(f"{EXMS}.markets", PropertyMock(return_value=mock_markets)) mocker.patch(f"{EXMS}.markets", PropertyMock(return_value=mock_markets))