Skip to content

Commit dc3c3d0

Browse files
sena-labsclaude
andcommitted
fix(test): use relative cache expiry to avoid CI timing fluke
On freshly-started CI runners time.monotonic() can be < 300 s, so setting _models_cache_ts = 0.0 left the cache appearing valid and the second pipes() call returned early without clearing _icons_synced. Subtract the full TTL + 1 from the stored timestamp instead so the cache is guaranteed expired regardless of system uptime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f05ab4a commit dc3c3d0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test_pipe.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,10 @@ def _ttl_reg_get(url, *args, **kwargs):
22172217
_pipe_sync_clear._icons_synced.add("openai/gpt-4o")
22182218
_assert(len(_pipe_sync_clear._icons_synced) == 1, "_icons_synced: populated before cache expire")
22192219

2220-
# Expire cache and call pipes() again — _icons_synced must be cleared
2221-
_pipe_sync_clear._models_cache_ts = 0.0
2220+
# Expire cache and call pipes() again — _icons_synced must be cleared.
2221+
# Subtract more than the TTL from the stored timestamp so the cache is
2222+
# expired regardless of how small time.monotonic() is on a fresh CI runner.
2223+
_pipe_sync_clear._models_cache_ts -= mod._MODELS_CACHE_TTL + 1
22222224
with patch.object(_pipe_sync_clear._session, "get", return_value=_mock_models_resp_sc):
22232225
_pipe_sync_clear.pipes()
22242226

0 commit comments

Comments
 (0)