Skip to content

Commit a1516ac

Browse files
committed
fix: resolve Python 3.10 compatibility in test files
- Remove UTC import from test_mcp_audit_logging.py (not available in Python 3.10) - Replace datetime.now(UTC) with datetime.now(timezone.utc) in tests - Add noqa comments for ruff UP017 rule suppression - Complete Python 3.10 compatibility across all files including tests
1 parent 98d5fdd commit a1516ac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/unit/test_mcp_audit_logging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import sqlite3
1313
import tempfile
1414
import unittest
15-
from datetime import datetime, timezone, UTC
15+
from datetime import datetime, timezone
1616
from pathlib import Path
1717
from unittest.mock import AsyncMock, MagicMock, patch
1818

@@ -287,7 +287,7 @@ def test_cleanup_expired_logs(self):
287287
cursor = conn.cursor()
288288

289289
# Insert a log entry that's already expired
290-
past_time = datetime.now(UTC).replace(year=2020).isoformat()
290+
past_time = datetime.now(timezone.utc).replace(year=2020).isoformat() # noqa: UP017
291291
cursor.execute(
292292
"""
293293
INSERT INTO mcp_audit_logs (
@@ -490,7 +490,7 @@ def test_purge_expired_data_dry_run(self):
490490
# First, create an expired entry
491491
with sqlite3.connect(str(self.db_path)) as conn:
492492
cursor = conn.cursor()
493-
past_time = datetime.now(UTC).replace(year=2020).isoformat()
493+
past_time = datetime.now(timezone.utc).replace(year=2020).isoformat() # noqa: UP017
494494
cursor.execute(
495495
"""
496496
INSERT INTO mcp_audit_logs (

0 commit comments

Comments
 (0)