From 81fdff103998cc3676e467fafef15beb7fe26a02 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Jul 2025 15:24:44 +0200 Subject: [PATCH] chore: simplify exchangews_ohlcv further --- tests/exchange/test_exchange_ws.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/exchange/test_exchange_ws.py b/tests/exchange/test_exchange_ws.py index 6be043c63..6fce00aee 100644 --- a/tests/exchange/test_exchange_ws.py +++ b/tests/exchange/test_exchange_ws.py @@ -118,22 +118,22 @@ async def test_exchangews_ohlcv(mocker, time_machine, caplog): # Wait for the expected number of watch calls 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() time_machine.shift(timedelta(minutes=5)) 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( 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 - await wait_for_condition( - lambda: exchange_ws._klines_watching == {("ETH/BTC", "1m", CandleType.SPOT)}, - timeout=2.0, - ) + # XRP/BTC should be cleaned up. + assert exchange_ws._klines_watching == { + ("ETH/BTC", "1m", CandleType.SPOT), + } # Cleanup happened. ccxt_object.un_watch_ohlcv_for_symbols = AsyncMock(side_effect=ValueError)