From e25929f50a496e4fe469c5f98598a34a53925b72 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 26 Feb 2022 15:53:01 +0100 Subject: [PATCH] Update test to not fail randomly --- tests/rpc/test_rpc_apiserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index a3214c84a..99817f706 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -610,7 +610,10 @@ def test_api_trade_single(botclient, mocker, fee, ticker, markets, is_short): assert rc.json()['detail'] == 'Trade not found.' create_mock_trades(fee, is_short=is_short) - Trade.query.session.flush() + + # The below line avoids random test failures. + # It's unclear why. + assert len(Trade.get_trades().all()) > 1 rc = client_get(client, f"{BASE_URI}/trade/3") assert_response(rc)