test(langgraph): use monotonic clock in flaky streaming test (#7477)

Switches test_sync_streaming_with_functional_api to time.monotonic() for
both emitted task timestamps and observed arrival times so the assertion
is based on a monotonic clock instead of wall time. This makes the
streaming timing check less flaky on systems where time.time() can jump
or lack sufficient precision.

Created with [Deep Agents
CLI](https://docs.langchain.com/oss/python/deepagents/cli/overview)
using gpt-5.4 (provider: openai).
This commit is contained in:
Eugene Yurtsev
2026-04-10 21:05:37 +00:00
committed by GitHub
parent 3a5b5c9821
commit bede0b7acf
+2 -2
View File
@@ -6271,7 +6271,7 @@ def test_sync_streaming_with_functional_api() -> None:
@task()
def slow() -> dict:
time.sleep(time_delay) # Simulate a delay of 10 ms
return {"tic": time.time()}
return {"tic": time.monotonic()}
@entrypoint()
def graph(inputs: dict) -> list:
@@ -6284,7 +6284,7 @@ def test_sync_streaming_with_functional_api() -> None:
for chunk in graph.stream({}):
if "slow" not in chunk: # We'll just look at the updates from `slow`
continue
arrival_times.append(time.time())
arrival_times.append(time.monotonic())
assert len(arrival_times) == 2
delta = arrival_times[1] - arrival_times[0]