Skip to content

Commit 0b1c408

Browse files
timsaucerclaude
andcommitted
Fix test_session_start_time failure on Python 3.10
datetime.fromisoformat() only supports up to 6 fractional-second digits (microseconds) on Python 3.10. Truncate nanosecond precision before parsing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 274fc3a commit 0b1c408

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python/tests/test_context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,12 @@ def test_table_not_found(ctx):
553553

554554
def test_session_start_time(ctx):
555555
import datetime
556+
import re
556557

557558
st = ctx.session_start_time()
558559
assert isinstance(st, str)
560+
# Truncate nanoseconds to microseconds for Python 3.10 compat
561+
st = re.sub(r"(\.\d{6})\d+", r"\1", st)
559562
dt = datetime.datetime.fromisoformat(st)
560563
assert dt.isoformat()
561564

0 commit comments

Comments
 (0)