Skip to content

Commit b1b6341

Browse files
committed
test: improve parallel test to capture caching
1 parent 8c92f94 commit b1b6341

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/data/test_history.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,13 @@ def test_refresh_backtest_ohlcv_data(
544544
):
545545
caplog.set_level(logging.DEBUG)
546546
dl_mock = mocker.patch("freqtrade.data.history.history_utils._download_pair_history")
547+
548+
def parallel_mock(pairs, timeframe, candle_type, **kwargs):
549+
return {(pair, timeframe, candle_type): DataFrame() for pair in pairs}
550+
547551
parallel_mock = mocker.patch(
548-
"freqtrade.data.history.history_utils._download_all_pairs_history_parallel", return_value={}
552+
"freqtrade.data.history.history_utils._download_all_pairs_history_parallel",
553+
side_effect=parallel_mock,
549554
)
550555
mocker.patch(f"{EXMS}.markets", PropertyMock(return_value=markets))
551556

@@ -565,8 +570,8 @@ def test_refresh_backtest_ohlcv_data(
565570
trading_mode=trademode,
566571
)
567572

568-
# Called once per timeframe and pair
569-
assert parallel_mock.call_count == 4
573+
# Called once per timeframe (as we return an empty dataframe)
574+
assert parallel_mock.call_count == 2
570575
assert dl_mock.call_count == callcount
571576
assert dl_mock.call_args[1]["timerange"].starttype == "date"
572577

0 commit comments

Comments
 (0)