Repository navigation
Replace legacy UTC aliases and enable Ruff UP017 - #348
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the UTC modernization changes.
No open issues 🎉
What changed in this PR
This PR modernizes UTC usage in tests across all three packages and in Functions test apps, supporting #323 without changing timezone awareness or timestamp values.
Changes:
- Replace
timezone.utcwithdatetime.UTCimports. - Remove the Ruff
UP017exclusion to enforce modern UTC aliases. - Pin exact serialized timestamps in the history regression test.
| File | Description |
|---|---|
tests/durabletask/test_tracing.py |
Use UTC in timer span tests. |
tests/durabletask/test_orchestration_state.py |
Use UTC in state fixtures. |
tests/durabletask/test_history_serialization.py |
Modernize UTC fixtures and pin serialized timestamps. |
tests/durabletask/test_delayed_signal_normalization.py |
Use UTC in signal normalization tests. |
tests/durabletask/test_client.py |
Modernize the completion-time filter timestamp. |
tests/durabletask/test_batch_actions.py |
Use UTC for query and purge windows. |
tests/durabletask/scheduled/test_scheduled_e2e.py |
Modernize schedule start timestamps. |
tests/durabletask/scheduled/test_schedule_entity.py |
Use UTC for schedule timing tests. |
tests/durabletask/scheduled/test_models.py |
Modernize timestamp fixtures and timezone assertions. |
tests/durabletask/scheduled/test_client_filter_and_capability.py |
Use UTC in schedule filter tests. |
tests/durabletask/extensions/history_export/test_serialization.py |
Modernize export serialization fixtures. |
tests/durabletask/extensions/history_export/test_orchestrator.py |
Use UTC for export job windows. |
tests/durabletask/extensions/history_export/test_models.py |
Modernize export bounds and normalization assertions. |
tests/durabletask/extensions/history_export/test_entity.py |
Use UTC in export window fixtures. |
tests/durabletask/extensions/history_export/test_client.py |
Modernize export client timestamps. |
tests/durabletask/extensions/history_export/test_activities.py |
Use UTC in export activity and blob-name tests. |
tests/durabletask/entities/test_delayed_signals_e2e.py |
Modernize delayed-signal timestamps. |
tests/durabletask-azuremanaged/test_resource_id.py |
Use UTC for expired-token fixtures. |
tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py |
Modernize token refresh expiry timestamps. |
tests/durabletask-azuremanaged/test_dts_batch_actions.py |
Use UTC for managed query and purge windows. |
tests/durabletask-azuremanaged/scheduled/test_dts_scheduled_e2e.py |
Modernize managed schedule start timestamps. |
tests/durabletask-azuremanaged/entities/test_dts_function_based_entities_e2e.py |
Use UTC in entity modification-time assertions. |
tests/durabletask-azuremanaged/entities/test_dts_delayed_signals_e2e.py |
Modernize managed delayed-signal timestamps. |
tests/durabletask-azuremanaged/entities/test_dts_class_based_entities_e2e.py |
Use UTC in entity modification-time assertions. |
tests/azure-functions-durable/test_http_builtin_compat.py |
Modernize HTTP orchestration and retry-time fixtures. |
tests/azure-functions-durable/test_history_export_compat.py |
Use UTC in export compatibility tests. |
tests/azure-functions-durable/test_entity_testing_support.py |
Modernize the entity signal-time fixture. |
tests/azure-functions-durable/test_durable_orchestration_status_compat.py |
Use UTC in status timestamp assertions. |
tests/azure-functions-durable/test_client_transport.py |
Modernize query bounds and protobuf conversions. |
tests/azure-functions-durable/test_client_compat.py |
Use UTC in client state and history fixtures. |
tests/azure-functions-durable/e2e/test_v1_client_e2e.py |
Modernize the purge-window timestamp. |
tests/azure-functions-durable/e2e/test_dtask_history_export_e2e.py |
Use UTC for the export completion window. |
tests/azure-functions-durable/e2e/apps/dtask_style/history_export_routes.py |
Modernize export route timestamps. |
tests/azure-functions-durable/e2e/apps/dtask_style/client_routes.py |
Use UTC when scheduling delayed signals. |
pyproject.toml |
Remove the temporary UP017 exclusion. |
Review effort: Balanced
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Looks good to me. UTC is the same timezone singleton as timezone.utc, so these replacements preserve timezone awareness, timestamp serialization and identity-sensitive checks without changing the supported Python versions. The literal history timestamp assertions strengthen the regression coverage, and UP017 is enforced while generated protobuf files remain excluded. I found no correctness, compatibility, replay or performance regressions.
Summary
datetime.UTC, preserving timezone-aware values.Fixes #323