Fix test leakage if config is available
This commit is contained in:
parent
09ee9089fb
commit
b8c1cf0107
@ -638,7 +638,7 @@ def test_get_ui_download_url_direct(mocker):
|
|||||||
x, last_version = get_ui_download_url('0.0.3')
|
x, last_version = get_ui_download_url('0.0.3')
|
||||||
|
|
||||||
|
|
||||||
def test_download_data_keyboardInterrupt(mocker, caplog, markets):
|
def test_download_data_keyboardInterrupt(mocker, markets):
|
||||||
dl_mock = mocker.patch('freqtrade.commands.data_commands.refresh_backtest_ohlcv_data',
|
dl_mock = mocker.patch('freqtrade.commands.data_commands.refresh_backtest_ohlcv_data',
|
||||||
MagicMock(side_effect=KeyboardInterrupt))
|
MagicMock(side_effect=KeyboardInterrupt))
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
@ -651,12 +651,15 @@ def test_download_data_keyboardInterrupt(mocker, caplog, markets):
|
|||||||
"--pairs", "ETH/BTC", "XRP/BTC",
|
"--pairs", "ETH/BTC", "XRP/BTC",
|
||||||
]
|
]
|
||||||
with pytest.raises(SystemExit):
|
with pytest.raises(SystemExit):
|
||||||
start_download_data(get_args(args))
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
|
||||||
|
start_download_data(pargs)
|
||||||
|
|
||||||
assert dl_mock.call_count == 1
|
assert dl_mock.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_download_data_timerange(mocker, caplog, markets):
|
def test_download_data_timerange(mocker, markets):
|
||||||
dl_mock = mocker.patch('freqtrade.commands.data_commands.refresh_backtest_ohlcv_data',
|
dl_mock = mocker.patch('freqtrade.commands.data_commands.refresh_backtest_ohlcv_data',
|
||||||
MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
|
MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
@ -672,7 +675,9 @@ def test_download_data_timerange(mocker, caplog, markets):
|
|||||||
]
|
]
|
||||||
with pytest.raises(OperationalException,
|
with pytest.raises(OperationalException,
|
||||||
match=r"--days and --timerange are mutually.*"):
|
match=r"--days and --timerange are mutually.*"):
|
||||||
start_download_data(get_args(args))
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
start_download_data(pargs)
|
||||||
assert dl_mock.call_count == 0
|
assert dl_mock.call_count == 0
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
@ -681,7 +686,9 @@ def test_download_data_timerange(mocker, caplog, markets):
|
|||||||
"--pairs", "ETH/BTC", "XRP/BTC",
|
"--pairs", "ETH/BTC", "XRP/BTC",
|
||||||
"--days", "20",
|
"--days", "20",
|
||||||
]
|
]
|
||||||
start_download_data(get_args(args))
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
start_download_data(pargs)
|
||||||
assert dl_mock.call_count == 1
|
assert dl_mock.call_count == 1
|
||||||
# 20days ago
|
# 20days ago
|
||||||
days_ago = arrow.get(arrow.now().shift(days=-20).date()).int_timestamp
|
days_ago = arrow.get(arrow.now().shift(days=-20).date()).int_timestamp
|
||||||
@ -694,7 +701,9 @@ def test_download_data_timerange(mocker, caplog, markets):
|
|||||||
"--pairs", "ETH/BTC", "XRP/BTC",
|
"--pairs", "ETH/BTC", "XRP/BTC",
|
||||||
"--timerange", "20200101-"
|
"--timerange", "20200101-"
|
||||||
]
|
]
|
||||||
start_download_data(get_args(args))
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
start_download_data(pargs)
|
||||||
assert dl_mock.call_count == 1
|
assert dl_mock.call_count == 1
|
||||||
|
|
||||||
assert dl_mock.call_args_list[0][1]['timerange'].startts == arrow.Arrow(
|
assert dl_mock.call_args_list[0][1]['timerange'].startts == arrow.Arrow(
|
||||||
|
Loading…
Reference in New Issue
Block a user