Use naive_utc_now in graph engine tests (#28735)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
-LAN- 2025-11-27 11:23:20 +08:00 committed by GitHub
parent f9b4c31344
commit 6deabfdad3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View File

@ -2,8 +2,6 @@
from __future__ import annotations
from datetime import datetime
from core.workflow.enums import NodeExecutionType, NodeState, NodeType, WorkflowNodeExecutionStatus
from core.workflow.graph import Graph
from core.workflow.graph_engine.domain.graph_execution import GraphExecution
@ -16,6 +14,7 @@ from core.workflow.graph_events import NodeRunRetryEvent, NodeRunStartedEvent
from core.workflow.node_events import NodeRunResult
from core.workflow.nodes.base.entities import RetryConfig
from core.workflow.runtime import GraphRuntimeState, VariablePool
from libs.datetime_utils import naive_utc_now
class _StubEdgeProcessor:
@ -75,7 +74,7 @@ def test_retry_does_not_emit_additional_start_event() -> None:
execution_id = "exec-1"
node_type = NodeType.CODE
start_time = datetime.utcnow()
start_time = naive_utc_now()
start_event = NodeRunStartedEvent(
id=execution_id,

View File

@ -3,7 +3,6 @@
from __future__ import annotations
import queue
from datetime import datetime
from unittest import mock
from core.workflow.entities.pause_reason import SchedulingPause
@ -18,6 +17,7 @@ from core.workflow.graph_events import (
NodeRunSucceededEvent,
)
from core.workflow.node_events import NodeRunResult
from libs.datetime_utils import naive_utc_now
def test_dispatcher_should_consume_remains_events_after_pause():
@ -109,7 +109,7 @@ def _make_started_event() -> NodeRunStartedEvent:
node_id="node-1",
node_type=NodeType.CODE,
node_title="Test Node",
start_at=datetime.utcnow(),
start_at=naive_utc_now(),
)
@ -119,7 +119,7 @@ def _make_succeeded_event() -> NodeRunSucceededEvent:
node_id="node-1",
node_type=NodeType.CODE,
node_title="Test Node",
start_at=datetime.utcnow(),
start_at=naive_utc_now(),
node_run_result=NodeRunResult(status=WorkflowNodeExecutionStatus.SUCCEEDED),
)
@ -153,7 +153,7 @@ def test_dispatcher_drain_event_queue():
node_id="node-1",
node_type=NodeType.CODE,
node_title="Code",
start_at=datetime.utcnow(),
start_at=naive_utc_now(),
),
NodeRunPauseRequestedEvent(
id="pause-event",
@ -165,7 +165,7 @@ def test_dispatcher_drain_event_queue():
id="success-event",
node_id="node-1",
node_type=NodeType.CODE,
start_at=datetime.utcnow(),
start_at=naive_utc_now(),
node_run_result=NodeRunResult(status=WorkflowNodeExecutionStatus.SUCCEEDED),
),
]