Skip to content

Commit ecfbfa2

Browse files
committed
test: try fix for test_exchangews_ohlcv random failures
1 parent 6b86214 commit ecfbfa2

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/exchange/test_exchange_ws.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ async def wait_for_condition(condition_func, timeout_=5.0, check_interval=0.01):
138138
}
139139

140140
# Cleanup happened.
141-
# Triggers 2nd call to un_watch_ohlcv_for_symbols which raises ValueError
142141
exchange_ws.schedule_ohlcv("ETH/BTC", "1m", CandleType.SPOT)
143142

144143
# Verify final state
@@ -149,10 +148,16 @@ async def wait_for_condition(condition_func, timeout_=5.0, check_interval=0.01):
149148
("ETH/BTC", "1m", CandleType.SPOT),
150149
}
151150

151+
# Triggers 2nd call to un_watch_ohlcv_for_symbols which raises ValueError
152+
exchange_ws._klines_watching.discard(("ETH/BTC", "1m", CandleType.SPOT))
153+
await wait_for_condition(
154+
lambda: log_has_re("Exception in _unwatch_ohlcv", caplog), timeout_=2.0
155+
)
156+
assert log_has_re("Exception in _unwatch_ohlcv", caplog)
157+
152158
finally:
153159
# Cleanup
154160
exchange_ws.cleanup()
155-
assert log_has_re("Exception in _unwatch_ohlcv", caplog)
156161

157162

158163
async def test_exchangews_get_ohlcv(mocker, caplog):

0 commit comments

Comments
 (0)