From ecfbfa2a3597899047cd4c38c060d3b6d8d1d855 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Feb 2026 11:49:01 +0100 Subject: [PATCH] test: try fix for test_exchangews_ohlcv random failures --- tests/exchange/test_exchange_ws.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/exchange/test_exchange_ws.py b/tests/exchange/test_exchange_ws.py index 06595e71ca3..2cc4873fe86 100644 --- a/tests/exchange/test_exchange_ws.py +++ b/tests/exchange/test_exchange_ws.py @@ -138,7 +138,6 @@ async def wait_for_condition(condition_func, timeout_=5.0, check_interval=0.01): } # Cleanup happened. - # Triggers 2nd call to un_watch_ohlcv_for_symbols which raises ValueError exchange_ws.schedule_ohlcv("ETH/BTC", "1m", CandleType.SPOT) # Verify final state @@ -149,10 +148,16 @@ async def wait_for_condition(condition_func, timeout_=5.0, check_interval=0.01): ("ETH/BTC", "1m", CandleType.SPOT), } + # Triggers 2nd call to un_watch_ohlcv_for_symbols which raises ValueError + exchange_ws._klines_watching.discard(("ETH/BTC", "1m", CandleType.SPOT)) + await wait_for_condition( + lambda: log_has_re("Exception in _unwatch_ohlcv", caplog), timeout_=2.0 + ) + assert log_has_re("Exception in _unwatch_ohlcv", caplog) + finally: # Cleanup exchange_ws.cleanup() - assert log_has_re("Exception in _unwatch_ohlcv", caplog) async def test_exchangews_get_ohlcv(mocker, caplog):