|
3 | 3 |
|
4 | 4 | import json |
5 | 5 | import logging |
6 | | -from datetime import UTC, datetime, timedelta |
| 6 | +from datetime import datetime, timedelta, timezone |
7 | 7 |
|
8 | 8 | import pytest |
9 | 9 |
|
@@ -86,7 +86,7 @@ def child(ctx: task.OrchestrationContext, _): |
86 | 86 | child_id = "child-no-colon" # ensure fallback derivation does not apply |
87 | 87 | exec_started = pb.HistoryEvent( |
88 | 88 | eventId=-1, |
89 | | - timestamp=helpers.new_timestamp(datetime.now(UTC)), |
| 89 | + timestamp=helpers.new_timestamp(datetime.now(timezone.utc)), |
90 | 90 | executionStarted=pb.ExecutionStartedEvent( |
91 | 91 | name=child_name, |
92 | 92 | input=helpers.get_string_value(None), |
@@ -909,7 +909,7 @@ def test_nondeterminism_expected_sub_orchestration_task_completion_wrong_task_ty |
909 | 909 |
|
910 | 910 | def orchestrator(ctx: task.OrchestrationContext, _): |
911 | 911 | result = yield ctx.create_timer( |
912 | | - datetime.now(UTC) |
| 912 | + datetime.now(timezone.utc) |
913 | 913 | ) # created timer but history expects sub-orchestration |
914 | 914 | return result |
915 | 915 |
|
@@ -1003,7 +1003,7 @@ def orchestrator(ctx: task.OrchestrationContext, _): |
1003 | 1003 |
|
1004 | 1004 | # Complete the timer task. The orchestration should move to the wait_for_external_event step, which |
1005 | 1005 | # 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) |
1007 | 1007 | old_events = new_events + [helpers.new_timer_created_event(1, timer_due_time)] |
1008 | 1008 | new_events = [helpers.new_timer_fired_event(1, timer_due_time)] |
1009 | 1009 | executor = worker._OrchestrationExecutor(registry, TEST_LOGGER) |
@@ -1096,9 +1096,9 @@ def orchestrator(ctx: task.OrchestrationContext, input: int): |
1096 | 1096 | helpers.new_event_raised_event("my_event", encoded_input="42"), |
1097 | 1097 | helpers.new_event_raised_event("my_event", encoded_input="43"), |
1098 | 1098 | 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)), |
1100 | 1100 | ] |
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))] |
1102 | 1102 |
|
1103 | 1103 | # Execute the orchestration. It should be in a running state waiting for the timer to fire |
1104 | 1104 | executor = worker._OrchestrationExecutor(registry, TEST_LOGGER) |
|
0 commit comments