From 9e47172d692f18249005644f1b1681cd8af197db Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 1 Aug 2024 20:37:26 +0200 Subject: [PATCH] chore: Reduce test flakyness of ws test --- tests/exchange_online/test_ccxt_ws_compat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/exchange_online/test_ccxt_ws_compat.py b/tests/exchange_online/test_ccxt_ws_compat.py index ed449bb58..78e6e317b 100644 --- a/tests/exchange_online/test_ccxt_ws_compat.py +++ b/tests/exchange_online/test_ccxt_ws_compat.py @@ -30,6 +30,12 @@ class TestCCXTExchangeWs: m_hist = mocker.spy(exch, "_async_get_historic_ohlcv") m_cand = mocker.spy(exch, "_async_get_candle_history") + while True: + # Don't start the test if we are too close to the end of the minute. + if dt_now().second < 50 and dt_now().second != 0: + break + sleep(1) + res = exch.refresh_latest_ohlcv([pair_tf]) assert m_cand.call_count == 1