完成 Ruff 全量清理

This commit is contained in:
yml2213
2026-08-31 10:55:44 +08:00
parent 840af3108e
commit 09ab80e062
68 changed files with 323 additions and 291 deletions
+4 -3
View File
@@ -3,7 +3,7 @@
import gzip
import logging
import tempfile
from datetime import datetime, timedelta
from datetime import UTC, datetime, timedelta
from pathlib import Path
from utils.logger import (
@@ -40,7 +40,8 @@ class TestLogger:
archives = list(Path(tmpdir).glob("app-2026-08-28.log.*.gz"))
assert len(archives) == 1
archived_content = gzip.open(archives[0], "rt", encoding="utf-8").read()
with gzip.open(archives[0], "rt", encoding="utf-8") as archive:
archived_content = archive.read()
current_content = log_path.read_text(encoding="utf-8")
combined = archived_content + current_content
assert "super-secret" not in combined
@@ -50,7 +51,7 @@ class TestLogger:
def test_daily_log_switches_to_a_new_dated_file(self):
with tempfile.TemporaryDirectory() as tmpdir:
today = datetime.now().date()
today = datetime.now(UTC).date()
old_path = (
Path(tmpdir) / f"app-{(today - timedelta(days=1)).isoformat()}.log"
)