mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-26 01:47:15 +01:00
fix: apply pre-commit formatting fixes to unblock CI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4cdfce5fe3
commit
f21f303872
@ -60,4 +60,6 @@ WAKE_AFTER_HOURS: int = 8
|
|||||||
# Path to the rtcwake binary.
|
# Path to the rtcwake binary.
|
||||||
RTCWAKE_BIN: str = "/usr/sbin/rtcwake"
|
RTCWAKE_BIN: str = "/usr/sbin/rtcwake"
|
||||||
# State file written by wake_alarm; read here to check for workout skip.
|
# State file written by wake_alarm; read here to check for workout skip.
|
||||||
WAKE_STATE_FILE = Path(__file__).resolve().parent.parent / "wake_alarm" / "wake_state.json"
|
WAKE_STATE_FILE = (
|
||||||
|
Path(__file__).resolve().parent.parent / "wake_alarm" / "wake_state.json"
|
||||||
|
)
|
||||||
|
|||||||
@ -10,12 +10,10 @@ import subprocess
|
|||||||
|
|
||||||
from screen_locker._constants import (
|
from screen_locker._constants import (
|
||||||
ADJUST_SHUTDOWN_SCRIPT,
|
ADJUST_SHUTDOWN_SCRIPT,
|
||||||
SHUTDOWN_CONFIG_FILE,
|
|
||||||
SICK_DAY_STATE_FILE,
|
|
||||||
)
|
|
||||||
from screen_locker._constants import (
|
|
||||||
ALARM_DAYS,
|
ALARM_DAYS,
|
||||||
RTCWAKE_BIN,
|
RTCWAKE_BIN,
|
||||||
|
SHUTDOWN_CONFIG_FILE,
|
||||||
|
SICK_DAY_STATE_FILE,
|
||||||
WAKE_AFTER_HOURS,
|
WAKE_AFTER_HOURS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -38,13 +38,13 @@ from screen_locker._phone_verification import PhoneVerificationMixin
|
|||||||
from screen_locker._shutdown import ShutdownMixin
|
from screen_locker._shutdown import ShutdownMixin
|
||||||
from screen_locker._sick_dialog import SickDialogMixin
|
from screen_locker._sick_dialog import SickDialogMixin
|
||||||
from screen_locker._ui_flows import UIFlowsMixin
|
from screen_locker._ui_flows import UIFlowsMixin
|
||||||
|
from screen_locker._wake_state import has_workout_skip_today
|
||||||
from screen_locker._weekly_check import (
|
from screen_locker._weekly_check import (
|
||||||
WEEKLY_WORKOUT_MINIMUM,
|
WEEKLY_WORKOUT_MINIMUM,
|
||||||
has_weekly_minimum,
|
has_weekly_minimum,
|
||||||
is_relaxed_day,
|
is_relaxed_day,
|
||||||
)
|
)
|
||||||
from screen_locker._window_setup import WindowSetupMixin
|
from screen_locker._window_setup import WindowSetupMixin
|
||||||
from screen_locker._wake_state import has_workout_skip_today
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|||||||
@ -3,16 +3,13 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from screen_locker._wake_state import has_workout_skip_today, load_wake_state
|
from screen_locker._wake_state import has_workout_skip_today, load_wake_state
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
from pathlib import Path
|
||||||
|
|
||||||
_TODAY = "2026-05-28"
|
_TODAY = "2026-05-28"
|
||||||
_STATE_PATH = "screen_locker._wake_state.WAKE_STATE_FILE"
|
_STATE_PATH = "screen_locker._wake_state.WAKE_STATE_FILE"
|
||||||
@ -196,8 +193,8 @@ class TestLoadWakeStateOsError:
|
|||||||
with (
|
with (
|
||||||
patch(_STATE_PATH, state_file),
|
patch(_STATE_PATH, state_file),
|
||||||
patch("screen_locker._wake_state.open", mock_open, create=True),
|
patch("screen_locker._wake_state.open", mock_open, create=True),
|
||||||
):
|
|
||||||
# We can't easily patch builtins.open for a specific file,
|
# We can't easily patch builtins.open for a specific file,
|
||||||
# so we test by patching the json.load path
|
# so we test by patching the json.load path
|
||||||
with patch("json.load", side_effect=OSError("disk error")):
|
patch("json.load", side_effect=OSError("disk error")),
|
||||||
assert load_wake_state() is None
|
):
|
||||||
|
assert load_wake_state() is None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user