Skip to content

Commit 3672367

Browse files
authored
Update test-py command and fix broken test (#521)
* Update test-py command and fix broken test * Use existing ensure_utc util function
1 parent 74518e7 commit 3672367

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ check-py: ## Runs checks (formatting, lints, type-checking) on the python packag
3434

3535

3636
test-py: ## Runs tests for the python packages.
37-
uv run pytest packages
37+
# NOTE: Due to namespace collisions with identically named test files across packages,
38+
# run tests per package: uv run pytest packages/package-name/tests
39+
@for pkg in packages/*/; do \
40+
if [ -d "$$pkg/tests" ]; then \
41+
echo "Running tests for $$pkg"; \
42+
uv run pytest "$$pkg/tests" || exit 1; \
43+
fi; \
44+
done
3845

3946

4047
build-py: ## Builds the python packages.

packages/smithy-core/src/smithy_core/interfaces/identity.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from datetime import UTC, datetime
44
from typing import Protocol, runtime_checkable
55

6+
from ..utils import ensure_utc
7+
68

79
@runtime_checkable
810
class Identity(Protocol):
@@ -14,6 +16,10 @@ class Identity(Protocol):
1416
If time zone is provided, it is updated to UTC. The value must always be in UTC.
1517
"""
1618

19+
def __post_init__(self) -> None:
20+
if self.expiration is not None:
21+
self.expiration = ensure_utc(self.expiration)
22+
1723
@property
1824
def is_expired(self) -> bool:
1925
"""Whether the identity is expired."""

0 commit comments

Comments
 (0)