Skip to content

Commit 064eea7

Browse files
committed
fix utc for py310
Signed-off-by: Filinto Duran <[email protected]>
1 parent 01dbb41 commit 064eea7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/durabletask/test_orchestration_executor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import json
55
import logging
6-
from datetime import UTC, datetime, timedelta
6+
from datetime import datetime, timedelta, timezone
77

88
import pytest
99

@@ -86,7 +86,7 @@ def child(ctx: task.OrchestrationContext, _):
8686
child_id = "child-no-colon" # ensure fallback derivation does not apply
8787
exec_started = pb.HistoryEvent(
8888
eventId=-1,
89-
timestamp=helpers.new_timestamp(datetime.now(UTC)),
89+
timestamp=helpers.new_timestamp(datetime.now(timezone.utc)),
9090
executionStarted=pb.ExecutionStartedEvent(
9191
name=child_name,
9292
input=helpers.get_string_value(None),
@@ -909,7 +909,7 @@ def test_nondeterminism_expected_sub_orchestration_task_completion_wrong_task_ty
909909

910910
def orchestrator(ctx: task.OrchestrationContext, _):
911911
result = yield ctx.create_timer(
912-
datetime.now(UTC)
912+
datetime.now(timezone.utc)
913913
) # created timer but history expects sub-orchestration
914914
return result
915915

@@ -1003,7 +1003,7 @@ def orchestrator(ctx: task.OrchestrationContext, _):
10031003

10041004
# Complete the timer task. The orchestration should move to the wait_for_external_event step, which
10051005
# should then complete immediately because the event was buffered in the old event history.
1006-
timer_due_time = datetime.now(UTC) + timedelta(days=1)
1006+
timer_due_time = datetime.now(timezone.utc) + timedelta(days=1)
10071007
old_events = new_events + [helpers.new_timer_created_event(1, timer_due_time)]
10081008
new_events = [helpers.new_timer_fired_event(1, timer_due_time)]
10091009
executor = worker._OrchestrationExecutor(registry, TEST_LOGGER)
@@ -1096,9 +1096,9 @@ def orchestrator(ctx: task.OrchestrationContext, input: int):
10961096
helpers.new_event_raised_event("my_event", encoded_input="42"),
10971097
helpers.new_event_raised_event("my_event", encoded_input="43"),
10981098
helpers.new_event_raised_event("my_event", encoded_input="44"),
1099-
helpers.new_timer_created_event(1, datetime.now(UTC) + timedelta(days=1)),
1099+
helpers.new_timer_created_event(1, datetime.now(timezone.utc) + timedelta(days=1)),
11001100
]
1101-
new_events = [helpers.new_timer_fired_event(1, datetime.now(UTC) + timedelta(days=1))]
1101+
new_events = [helpers.new_timer_fired_event(1, datetime.now(timezone.utc) + timedelta(days=1))]
11021102

11031103
# Execute the orchestration. It should be in a running state waiting for the timer to fire
11041104
executor = worker._OrchestrationExecutor(registry, TEST_LOGGER)

0 commit comments

Comments
 (0)