Reset logging mixin to avoid random test failure

This commit is contained in:
Matthias 2022-05-26 18:05:40 +02:00
parent da970cca82
commit 682daa4e94
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,14 @@ logger = logging.getLogger(__name__)
__logging_mixin = None __logging_mixin = None
def _reset_logging_mixin():
"""
Reset global logging mixin - used in tests only.
"""
global __logging_mixin
__logging_mixin = LoggingMixin(logger)
def _get_logging_mixin(): def _get_logging_mixin():
# Logging-mixin to cache kucoin responses # Logging-mixin to cache kucoin responses
# Only to be used in retrier # Only to be used in retrier

View File

@ -2155,6 +2155,8 @@ async def test__async_get_candle_history(default_conf, mocker, caplog, exchange_
@pytest.mark.asyncio @pytest.mark.asyncio
async def test__async_kucoin_get_candle_history(default_conf, mocker, caplog): async def test__async_kucoin_get_candle_history(default_conf, mocker, caplog):
from freqtrade.exchange.common import _reset_logging_mixin
_reset_logging_mixin()
caplog.set_level(logging.INFO) caplog.set_level(logging.INFO)
api_mock = MagicMock() api_mock = MagicMock()
api_mock.fetch_ohlcv = MagicMock(side_effect=ccxt.DDoSProtection( api_mock.fetch_ohlcv = MagicMock(side_effect=ccxt.DDoSProtection(