Fix failing test in python 3.7

can't use Magicmock in 3.7 (works in 3.8 though).
This commit is contained in:
Matthias 2020-06-28 20:17:03 +02:00
parent c6124180fe
commit 4d9ecf137b
2 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ def retrier_async(f):
count -= 1
kwargs.update({'count': count})
logger.warning('retrying %s() still for %s times', f.__name__, count)
if isinstance(ex, DDosProtection) or isinstance(ex, RetryableOrderError):
if isinstance(ex, DDosProtection):
await asyncio.sleep(calculate_backoff(count + 1, API_RETRY_COUNT))
return await wrapper(*args, **kwargs)
else:

View File

@ -62,7 +62,7 @@ def ccxt_exceptionhandlers(mocker, default_conf, api_mock, exchange_name,
async def async_ccxt_exception(mocker, default_conf, api_mock, fun, mock_ccxt_fun,
retries=API_RETRY_COUNT + 1, **kwargs):
with patch('freqtrade.exchange.common.asyncio.sleep'):
with patch('freqtrade.exchange.common.asyncio.sleep', get_mock_coro(None)):
with pytest.raises(DDosProtection):
api_mock.__dict__[mock_ccxt_fun] = MagicMock(side_effect=ccxt.DDoSProtection("Dooh"))
exchange = get_patched_exchange(mocker, default_conf, api_mock)