chore: simplify exchangews_ohlcv further

This commit is contained in:
Matthias
2025-07-04 15:24:44 +02:00
parent 5101b1767b
commit 81fdff1039

View File

@@ -118,22 +118,22 @@ async def test_exchangews_ohlcv(mocker, time_machine, caplog):
# Wait for the expected number of watch calls # Wait for the expected number of watch calls
await wait_for_condition(lambda: ccxt_object.watch_ohlcv.call_count >= 6, timeout=3.0) await wait_for_condition(lambda: ccxt_object.watch_ohlcv.call_count >= 6, timeout=3.0)
assert ccxt_object.watch_ohlcv.call_count == 6 assert ccxt_object.watch_ohlcv.call_count >= 6
ccxt_object.watch_ohlcv.reset_mock() ccxt_object.watch_ohlcv.reset_mock()
time_machine.shift(timedelta(minutes=5)) time_machine.shift(timedelta(minutes=5))
exchange_ws.schedule_ohlcv("ETH/BTC", "1m", CandleType.SPOT) exchange_ws.schedule_ohlcv("ETH/BTC", "1m", CandleType.SPOT)
# Wait for log message and state changes with timeout # Wait for log message
await wait_for_condition( await wait_for_condition(
lambda: log_has_re("un_watch_ohlcv_for_symbols not supported: ", caplog), timeout=2.0 lambda: log_has_re("un_watch_ohlcv_for_symbols not supported: ", caplog), timeout=2.0
) )
assert log_has_re("un_watch_ohlcv_for_symbols not supported: ", caplog)
# Wait for XRP/BTC cleanup # XRP/BTC should be cleaned up.
await wait_for_condition( assert exchange_ws._klines_watching == {
lambda: exchange_ws._klines_watching == {("ETH/BTC", "1m", CandleType.SPOT)}, ("ETH/BTC", "1m", CandleType.SPOT),
timeout=2.0, }
)
# Cleanup happened. # Cleanup happened.
ccxt_object.un_watch_ohlcv_for_symbols = AsyncMock(side_effect=ValueError) ccxt_object.un_watch_ohlcv_for_symbols = AsyncMock(side_effect=ValueError)