From 5101b1767bf1a39687cf1528caa70741d5ce9700 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Jul 2025 15:03:44 +0200 Subject: [PATCH] test: slightly cleanup ws_ohlcv test --- tests/exchange/test_exchange_ws.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/exchange/test_exchange_ws.py b/tests/exchange/test_exchange_ws.py index 02cf761b8..6be043c63 100644 --- a/tests/exchange/test_exchange_ws.py +++ b/tests/exchange/test_exchange_ws.py @@ -69,16 +69,8 @@ async def test_exchangews_ohlcv(mocker, time_machine, caplog): ccxt_object = MagicMock() caplog.set_level(logging.DEBUG) - # Create synchronization events for deterministic testing - watch_call_event = asyncio.Event() - watch_call_count = 0 - async def controlled_sleeper(*args, **kwargs): - """Controlled async function that signals when called.""" - nonlocal watch_call_count - watch_call_count += 1 - # Signal that a watch call happened - watch_call_event.set() + # Sleep to pass control back to the event loop await asyncio.sleep(0.1) return MagicMock() @@ -124,7 +116,7 @@ async def test_exchangews_ohlcv(mocker, time_machine, caplog): ("XRP/BTC", "1m", CandleType.SPOT), } - # Wait for the expected number of watch calls (should be 6 based on original test logic) + # 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 ccxt_object.watch_ohlcv.reset_mock()