mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
style(python): import datetime as dt for ruff 0.17
ruff 0.17.0 adds `datetime` -> `dt` to the default aliases of flake8-import-conventions, and the project selects ICN, so lint-python failed with ICN001 in seven files. The files now import `datetime as dt`. ruff's unsafe fix also renamed two local names in utils/github/playwright_summary.py into the alias: the `_to_iso_z` parameter and the parsed value in `_parse_iso_timestamp`. Both are now called `moment`; with the bare fix, nine tests of test_playwright_summary.py failed with UnboundLocalError and AttributeError. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
753badd8b8
commit
47565781ea
7 files changed
+40
-45
No files matched your search
@@ -10,7 +10,7 @@ directories / no junit files / unparseable junit files.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import datetime as dt
|
||||
import io
|
||||
import os
|
||||
import unittest
|
||||
@@ -56,9 +56,7 @@ def _write(path: Path, content: str) -> Path:
|
||||
class TestToIsoZ(unittest.TestCase):
|
||||
def test_utc_datetime_formats_with_z_suffix(self) -> None:
|
||||
self.assertEqual(
|
||||
ps._to_iso_z(
|
||||
datetime.datetime(2026, 5, 17, 12, 34, 56, tzinfo=datetime.UTC)
|
||||
),
|
||||
ps._to_iso_z(dt.datetime(2026, 5, 17, 12, 34, 56, tzinfo=dt.UTC)),
|
||||
"2026-05-17T12:34:56Z",
|
||||
)
|
||||
|
||||
@@ -263,9 +261,7 @@ class TestSummarizeFile(unittest.TestCase):
|
||||
Path(tmp) / "web-app-foo" / "playwright-junit.xml",
|
||||
no_timestamp_fixture,
|
||||
)
|
||||
target = datetime.datetime(
|
||||
2025, 5, 17, 5, 34, 56, tzinfo=datetime.UTC
|
||||
).timestamp()
|
||||
target = dt.datetime(2025, 5, 17, 5, 34, 56, tzinfo=dt.UTC).timestamp()
|
||||
os.utime(xml_path, (target, target))
|
||||
summary = ps._summarize_file(xml_path)
|
||||
assert summary is not None
|
||||
|
||||
Reference in new issue
Block a user