Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
test(connected-accounts,py): patch time.time defensively in terminal-state test
`test_wait_for_connection_fails_fast_on_terminal_status` only patched `time.sleep`, not `time.time`. A stuck CI runner could in principle exhaust the 10s deadline before the first `retrieve()` call resolves, in which case the test would assert against a `ComposioSDKTimeoutError` instead of the `SDKError` it's actually exercising. Match the monotonic-counter pattern used by the sibling tests at lines 137 and 170 to remove that flake surface. Surfaced by kieran-python review of PR #3344 (P3#4).
jkomyno committed
May 7, 2026 at 10:56 UTC
27a4e6448e088bd4ff30b91cb579e184c67cabba
1 file changed
+12
python/tests/test_connected_accounts.py
+12
@@ -194,6 +194,18 @@ class TestConnectionRequest:
194
client=mock_client,
195
)
196
197
+ # Defensively patch `time.time` (matches sibling tests at lines 137,
198
+ # 170): a stuck CI runner could otherwise reach the deadline before
199
+ # the first retrieve call lands, masking the SDKError assertion as a
200
+ # ComposioSDKTimeoutError.
201
+ current_time = {"value": 0.0}
202
+
203
+ def fake_time():
204
+ value = current_time["value"]
205
+ current_time["value"] += 0.1
206
+ return value
207
+
208
+ monkeypatch.setattr(time, "time", fake_time)
209
monkeypatch.setattr(time, "sleep", lambda *_args, **_kwargs: None)
210
211
with pytest.raises(exceptions.SDKError) as excinfo: