Skip to content

Replace legacy UTC aliases and enable Ruff UP017 - #348

Merged
andystaples merged 1 commit into
mainfrom
andystaples-replace-legacy-utc-aliases-enable-ruff-u
Nov 11, 2026
Merged

andystaples merged 1 commit into
mainfrom
andystaples-replace-legacy-utc-aliases-enable-ruff-u

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Summary

  • Replace legacy UTC aliases in tests and Functions test apps with datetime.UTC, preserving timezone-aware values.
  • Enable Ruff's UP017 rule to prevent new legacy aliases.
  • Pin serialized timestamp output in the history regression test.

Fixes #323

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.utc with datetime.UTC imports.
  • Remove the Ruff UP017 exclusion 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

@berndverst Bernd Verst (berndverst) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@andystaples
andystaples merged commit 591f2db into main Nov 11, 2026
26 checks passed
@andystaples
andystaples deleted the andystaples-replace-legacy-utc-aliases-enable-ruff-u branch November 11, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace legacy UTC aliases and enable Ruff UP017

3 participants