From 3ec7c2a81efdb2b504a516123c95a335c1fd5bba Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Mar 2026 12:40:17 -0700 Subject: [PATCH] [Fix] Fail fast when team member spend not flushed in time Increase wait timeout to 90s and pytest.fail() instead of silently continuing, so the failure message points at the real cause. Co-Authored-By: Claude Opus 4.6 --- tests/test_team.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_team.py b/tests/test_team.py index d73e36d1df..550c953fdd 100644 --- a/tests/test_team.py +++ b/tests/test_team.py @@ -802,16 +802,17 @@ async def test_users_in_team_budget(): # Wait for spend to be committed to database before checking budget # Spend updates are queued asynchronously and committed periodically (every minute), # so we need to wait for the spend from Call 1 to be persisted - # Note: Even if cost is 0 (model has no pricing), we wait to ensure the update queue is processed print("\n[DEBUG] ===== Waiting for spend to be committed =====") print("Waiting for team member spend to be committed to database...") - print("Note: Spend updates are flushed periodically, this may take up to 60 seconds...") + print("Note: Spend updates are flushed periodically, this may take up to 90 seconds...") spend_updated = await wait_for_team_member_spend_update( - session, get_user, team["team_id"], 0.0000001, max_wait=65 + session, get_user, team["team_id"], 0.0000001, max_wait=90 ) if not spend_updated: - print("[WARNING] Team member spend not updated in time, but continuing test...") - print("This may indicate the spend update queue hasn't been flushed yet.") + pytest.fail( + "Team member spend was not updated within 90s. " + "The spend update queue may not have flushed, or the model may have 0 cost." + ) # Check user info BEFORE Call 2 user_info_before_call2 = await get_user_info(session, get_user, call_user="sk-1234")