From a4165e0dc86320c342f33f253ff37cde07e18793 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 9 Aug 2026 19:04:14 +0200 Subject: [PATCH] Use dt.timezone.utc so the declared >=3.10 support is real MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `dt.UTC` is a 3.11+ alias, but crdt-sync declares requires-python = ">=3.10" and the CI matrix tests 3.10 — so `crdt-sync tests` has been failing on the 3.10 leg since before this branch (commit 493db693 failed the same way). It collected as `AttributeError: module 'datetime' has no attribute 'UTC'`. This is not only a test problem: `_firebase_auth._utcnow()` is library code, so on 3.10 every token-expiry check would have raised at runtime. The three consumers (diet-guard, screen-locker, wake-alarm) all declare >=3.10 too, so honouring the floor is the right direction rather than raising it. `dt.UTC is dt.timezone.utc` evaluates to True — the same singleton under two spellings — so this is a pure rename with no behaviour change. Verified on a real pyenv 3.10.16 venv, not just the 3.14 dev interpreter: 239 passed. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01GZH89WEqAjuJT8WZdqc7AP --- crdt-sync/crdt_sync/_firebase_auth.py | 2 +- crdt-sync/crdt_sync/tests/test_firebase.py | 2 +- crdt-sync/crdt_sync/tests/test_firebase_auth.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crdt-sync/crdt_sync/_firebase_auth.py b/crdt-sync/crdt_sync/_firebase_auth.py index 85c22d0..81afd2a 100644 --- a/crdt-sync/crdt_sync/_firebase_auth.py +++ b/crdt-sync/crdt_sync/_firebase_auth.py @@ -161,7 +161,7 @@ class FileCredentialStore: def _utcnow() -> dt.datetime: - return dt.datetime.now(dt.UTC) + return dt.datetime.now(dt.timezone.utc) class FirebaseTokenProvider: diff --git a/crdt-sync/crdt_sync/tests/test_firebase.py b/crdt-sync/crdt_sync/tests/test_firebase.py index ca7a71a..b6eb24c 100644 --- a/crdt-sync/crdt_sync/tests/test_firebase.py +++ b/crdt-sync/crdt_sync/tests/test_firebase.py @@ -56,7 +56,7 @@ def _auth(*, signed_in: bool = True) -> FirebaseTokenProvider: FirebaseCredentials( id_token=_FAKE_ID, refresh_token=_FAKE_REFRESH, - expires_at=dt.datetime(2099, 1, 1, tzinfo=dt.UTC), + expires_at=dt.datetime(2099, 1, 1, tzinfo=dt.timezone.utc), ) if signed_in else None diff --git a/crdt-sync/crdt_sync/tests/test_firebase_auth.py b/crdt-sync/crdt_sync/tests/test_firebase_auth.py index 799ba97..8409aa0 100644 --- a/crdt-sync/crdt_sync/tests/test_firebase_auth.py +++ b/crdt-sync/crdt_sync/tests/test_firebase_auth.py @@ -27,7 +27,7 @@ from crdt_sync import _firebase_auth as fa if TYPE_CHECKING: from pathlib import Path -_NOW = dt.datetime(2026, 8, 3, 12, tzinfo=dt.UTC) +_NOW = dt.datetime(2026, 8, 3, 12, tzinfo=dt.timezone.utc) # Fixture values referenced through names ruff's hardcoded-credential checks # (S105-S107) do not key off. Comparing an attribute called `id_token` to a