Skip to content

Commit 7fd100c

Browse files
renovate[bot]agnersclaude
authored
Update ruff to v0.17.0 (#7363)
* Update ruff to v0.17.0 * Import datetime members directly in core tests Ruff 0.17.0 adds `datetime as dt` as a default import convention (ICN001), which flags the plain `import datetime` module import in tests/test_core.py. Import the used members directly instead, matching how the rest of the code base imports datetime. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Stefan Agner <stefan@agner.ch> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 4c05d4f commit 7fd100c

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.16.10
3+
rev: v0.17.0
44
hooks:
55
- id: ruff
66
args:

‎requirements_tests.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pytest-cov==7.1.0
99
pytest-timeout==2.4.0
1010
pytest-xdist==3.8.0
1111
pytest==9.1.1
12-
ruff==0.16.10
12+
ruff==0.17.0
1313
time-machine==3.5.1
1414
types-pyyaml==6.0.12.20260906
1515
urllib3==2.8.0

‎tests/test_core.py‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# pylint: disable=W0212
44
import asyncio
55
from contextlib import suppress
6-
import datetime
6+
from datetime import UTC, datetime, timedelta
77
import errno
88
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
99

@@ -59,7 +59,7 @@ async def test_write_state(run_supervisor_state: MagicMock, coresys: CoreSys):
5959

6060
async def test_adjust_system_datetime(coresys: CoreSys, websession: MagicMock):
6161
"""Test _adjust_system_datetime method with successful retrieve_whoami."""
62-
utc_ts = datetime.datetime.now().replace(tzinfo=datetime.UTC)
62+
utc_ts = datetime.now().replace(tzinfo=UTC)
6363
with patch(
6464
"supervisor.core.retrieve_whoami",
6565
new_callable=AsyncMock,
@@ -79,7 +79,7 @@ async def test_adjust_system_datetime_without_ssl(
7979
coresys: CoreSys, websession: MagicMock
8080
):
8181
"""Test _adjust_system_datetime method when retrieve_whoami raises WhoamiSSLError."""
82-
utc_ts = datetime.datetime.now().replace(tzinfo=datetime.UTC)
82+
utc_ts = datetime.now().replace(tzinfo=UTC)
8383
with patch(
8484
"supervisor.core.retrieve_whoami",
8585
new_callable=AsyncMock,
@@ -104,9 +104,7 @@ async def test_adjust_system_datetime_if_time_behind(
104104
systemd_unit_service.active_state = "active"
105105
systemd_unit_service.active_state_read.clear()
106106

107-
utc_ts = datetime.datetime.now().replace(tzinfo=datetime.UTC) + datetime.timedelta(
108-
hours=1, minutes=1
109-
)
107+
utc_ts = datetime.now().replace(tzinfo=UTC) + timedelta(hours=1, minutes=1)
110108
with (
111109
patch(
112110
"supervisor.core.retrieve_whoami",

0 commit comments

Comments
 (0)