Fix failing test in python 3.7
can't use Magicmock in 3.7 (works in 3.8 though).
This commit is contained in:
parent
c6124180fe
commit
4d9ecf137b
@ -110,7 +110,7 @@ def retrier_async(f):
|
|||||||
count -= 1
|
count -= 1
|
||||||
kwargs.update({'count': count})
|
kwargs.update({'count': count})
|
||||||
logger.warning('retrying %s() still for %s times', f.__name__, 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))
|
await asyncio.sleep(calculate_backoff(count + 1, API_RETRY_COUNT))
|
||||||
return await wrapper(*args, **kwargs)
|
return await wrapper(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
@ -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,
|
async def async_ccxt_exception(mocker, default_conf, api_mock, fun, mock_ccxt_fun,
|
||||||
retries=API_RETRY_COUNT + 1, **kwargs):
|
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):
|
with pytest.raises(DDosProtection):
|
||||||
api_mock.__dict__[mock_ccxt_fun] = MagicMock(side_effect=ccxt.DDoSProtection("Dooh"))
|
api_mock.__dict__[mock_ccxt_fun] = MagicMock(side_effect=ccxt.DDoSProtection("Dooh"))
|
||||||
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
exchange = get_patched_exchange(mocker, default_conf, api_mock)
|
||||||
|
Loading…
Reference in New Issue
Block a user