mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-07-04 11:43:09 +02:00
Reduce per-file-ignores by fixing lint violations across codebase
Fix ruff violations in ~15 source files and ~60+ test files to minimize per-file-ignores in pyproject.toml. Remaining ignores are justified with comments explaining why each suppression is necessary. Source fixes: FBT003 (keyword args), S310 (URL validation), SLF001 (private access), T201 (print→logging), C901 (complexity), E501 (line length), E402 (import order). Test fixes: SIM117 (combined with), FBT (boolean args), PERF203 (try in loop), S310/S607 (URLs/executables), E402/E501 (imports/lines), S108 (tmp paths), PLR0913 (too many args), ARG (unused args), ANN (type annotations), RUF059 (unused unpacked vars), PT019 (fixture naming). Remaining per-file-ignores (with justifications): - Tests: ARG, D, PLC0415, PLR2004, S101, SLF001 - music_gen sources: PLC0415 (heavy ML lazy imports) - moviepy_showcase: PLC0415 (circular dependency) - generate_images: PLR0913 (matplotlib helpers need many params) - praca_magisterska_video: E501, E402 (long paths, mpl.use)
This commit is contained in:
parent
d8f8b21827
commit
d56ed74acc
@ -92,10 +92,10 @@ class ScreenLocker(
|
||||
"""Configure the window for fullscreen lock."""
|
||||
screen_w = self.root.winfo_screenwidth()
|
||||
screen_h = self.root.winfo_screenheight()
|
||||
self.root.overrideredirect(True)
|
||||
self.root.overrideredirect(boolean=True)
|
||||
self.root.geometry(f"{screen_w}x{screen_h}+0+0")
|
||||
self.root.attributes("-fullscreen", True)
|
||||
self.root.attributes("-topmost", True)
|
||||
self.root.attributes(fullscreen=True)
|
||||
self.root.attributes(topmost=True)
|
||||
self.root.configure(bg="#1a1a1a", cursor="arrow")
|
||||
|
||||
def _setup_demo_close_button(self) -> None:
|
||||
|
||||
@ -21,7 +21,7 @@ class TestRunAdb:
|
||||
def test_run_adb_success(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful ADB command."""
|
||||
@ -40,7 +40,7 @@ class TestRunAdb:
|
||||
def test_run_adb_failure(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test failed ADB command."""
|
||||
@ -57,7 +57,7 @@ class TestRunAdb:
|
||||
def test_run_adb_not_found(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB binary not found."""
|
||||
@ -74,7 +74,7 @@ class TestRunAdb:
|
||||
def test_run_adb_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB OSError."""
|
||||
@ -91,7 +91,7 @@ class TestRunAdb:
|
||||
def test_run_adb_timeout(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB command timeout."""
|
||||
@ -112,7 +112,7 @@ class TestAdbShell:
|
||||
def test_adb_shell_no_root(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB shell without root."""
|
||||
@ -134,7 +134,7 @@ class TestAdbShell:
|
||||
def test_adb_shell_with_root(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB shell with root."""
|
||||
@ -161,7 +161,7 @@ class TestIsPhoneConnected:
|
||||
def test_phone_connected(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test phone detected as connected."""
|
||||
@ -182,7 +182,7 @@ class TestIsPhoneConnected:
|
||||
def test_phone_not_connected(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test no phone connected."""
|
||||
@ -207,7 +207,7 @@ class TestIsPhoneConnected:
|
||||
def test_phone_offline(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test phone connected but offline."""
|
||||
@ -235,7 +235,7 @@ class TestIsPhoneConnected:
|
||||
def test_adb_command_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ADB command failure."""
|
||||
@ -264,7 +264,7 @@ class TestFindHealthConnectDb:
|
||||
def test_db_pulled_successfully(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test StrongLifts DB pulled from device."""
|
||||
@ -295,7 +295,7 @@ class TestFindHealthConnectDb:
|
||||
def test_db_cat_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when cat command fails."""
|
||||
@ -313,7 +313,7 @@ class TestFindHealthConnectDb:
|
||||
def test_db_pull_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when adb pull fails."""
|
||||
@ -338,7 +338,7 @@ class TestFindHealthConnectDb:
|
||||
def test_db_uses_correct_remote_path(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test uses the correct StrongLifts DB remote path."""
|
||||
@ -370,7 +370,7 @@ class TestCountTodayWorkouts:
|
||||
def test_workouts_found_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test workouts found today."""
|
||||
@ -395,7 +395,7 @@ class TestCountTodayWorkouts:
|
||||
def test_no_workouts_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test no workouts today."""
|
||||
@ -420,7 +420,7 @@ class TestCountTodayWorkouts:
|
||||
def test_invalid_db_returns_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns 0 for invalid database file."""
|
||||
@ -433,7 +433,7 @@ class TestCountTodayWorkouts:
|
||||
def test_missing_table_returns_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns 0 when workouts table doesn't exist."""
|
||||
@ -449,7 +449,7 @@ class TestCountTodayWorkouts:
|
||||
def test_multiple_workouts_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test counts multiple workouts today correctly."""
|
||||
|
||||
@ -105,7 +105,7 @@ class TestHasLoggedToday:
|
||||
def test_no_log_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test when log file doesn't exist."""
|
||||
@ -118,7 +118,7 @@ class TestHasLoggedToday:
|
||||
def test_empty_log_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test when log file is empty/invalid JSON."""
|
||||
@ -132,7 +132,7 @@ class TestHasLoggedToday:
|
||||
def test_invalid_json(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test when log file contains invalid JSON."""
|
||||
@ -146,7 +146,7 @@ class TestHasLoggedToday:
|
||||
def test_today_logged(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test when today's workout is logged."""
|
||||
@ -161,7 +161,7 @@ class TestHasLoggedToday:
|
||||
def test_other_day_logged(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test when only other days are logged."""
|
||||
@ -179,7 +179,7 @@ class TestSaveWorkoutLog:
|
||||
def test_save_to_new_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test saving to a new log file."""
|
||||
@ -199,7 +199,7 @@ class TestSaveWorkoutLog:
|
||||
def test_save_to_existing_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test saving appends to existing log file."""
|
||||
@ -220,7 +220,7 @@ class TestSaveWorkoutLog:
|
||||
def test_save_with_corrupted_existing_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test saving when existing file is corrupted."""
|
||||
@ -240,7 +240,7 @@ class TestSaveWorkoutLog:
|
||||
def test_save_with_write_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test saving handles write errors gracefully."""
|
||||
@ -259,7 +259,7 @@ class TestShowError:
|
||||
def test_show_error_displays_message(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test show_error clears container and displays error."""
|
||||
@ -277,7 +277,7 @@ class TestRun:
|
||||
def test_run_starts_mainloop(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test run starts the tkinter mainloop."""
|
||||
@ -294,7 +294,7 @@ class TestMainEntry:
|
||||
def test_main_demo_mode_default(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test main defaults to demo mode."""
|
||||
@ -305,7 +305,7 @@ class TestMainEntry:
|
||||
def test_main_production_mode_flag(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test main with --production flag."""
|
||||
@ -320,7 +320,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_adjust_shutdown_time_later_success(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _adjust_shutdown_time_later adds hours successfully."""
|
||||
@ -340,7 +340,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_adjust_shutdown_time_later_caps_at_23(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _adjust_shutdown_time_later caps hours at 23."""
|
||||
@ -361,7 +361,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_adjust_shutdown_time_later_no_config(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _adjust_shutdown_time_later returns False if config missing."""
|
||||
@ -377,7 +377,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_adjust_shutdown_time_later_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _adjust_shutdown_time_later handles OSError."""
|
||||
@ -397,7 +397,7 @@ class TestGrabInput:
|
||||
"""Tests for _grab_input method."""
|
||||
|
||||
def test_production_global_grab_tcl_error(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test production mode falls back when global grab fails."""
|
||||
mock_tk.Tk.return_value.grab_set_global.side_effect = tk.TclError("grab failed")
|
||||
|
||||
@ -21,7 +21,7 @@ class TestVerifyPhoneWorkout:
|
||||
def test_verified(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test workout verified on phone."""
|
||||
@ -56,7 +56,7 @@ class TestVerifyPhoneWorkout:
|
||||
def test_not_verified(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test no workout found on phone."""
|
||||
@ -91,7 +91,7 @@ class TestVerifyPhoneWorkout:
|
||||
def test_no_phone(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test no phone connected."""
|
||||
@ -111,7 +111,7 @@ class TestVerifyPhoneWorkout:
|
||||
def test_error_no_db(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test error when StrongLifts DB cannot be pulled."""
|
||||
@ -143,7 +143,7 @@ class TestStartPhoneCheck:
|
||||
def test_start_phone_check_shows_checking_screen(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _start_phone_check shows checking message and starts check."""
|
||||
@ -167,7 +167,7 @@ class TestStartPhoneCheck:
|
||||
def test_handle_startup_verified_unlocks_directly(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test verified result shows success screen then unlocks via after()."""
|
||||
@ -185,7 +185,7 @@ class TestStartPhoneCheck:
|
||||
def test_handle_startup_not_verified_shows_block(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test not_verified result shows blocking screen with buttons."""
|
||||
@ -200,7 +200,7 @@ class TestStartPhoneCheck:
|
||||
def test_handle_startup_no_phone_shows_penalty(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test no_phone result triggers penalty with ask_workout_done as callback."""
|
||||
@ -216,7 +216,7 @@ class TestStartPhoneCheck:
|
||||
def test_handle_startup_error_shows_penalty(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test error result triggers penalty with ask_workout_done as callback."""
|
||||
@ -232,7 +232,7 @@ class TestStartPhoneCheck:
|
||||
def test_poll_phone_check_schedules_retry_when_pending(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _poll_phone_check reschedules itself when future is not done."""
|
||||
@ -249,7 +249,7 @@ class TestStartPhoneCheck:
|
||||
def test_poll_phone_check_routes_when_done(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _poll_phone_check calls result handler when future is done."""
|
||||
@ -273,7 +273,7 @@ class TestAttemptUnlock:
|
||||
def test_attempt_unlock_calls_unlock_screen(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test _attempt_unlock calls unlock_screen directly."""
|
||||
@ -293,7 +293,7 @@ class TestShowPhonePenalty:
|
||||
def test_show_phone_penalty_demo_delay(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test demo mode uses short penalty delay."""
|
||||
@ -308,7 +308,7 @@ class TestShowPhonePenalty:
|
||||
def test_show_phone_penalty_production_delay(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test production mode uses long penalty delay."""
|
||||
@ -322,7 +322,7 @@ class TestShowPhonePenalty:
|
||||
def test_update_phone_penalty_countdown(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test phone penalty countdown decrements."""
|
||||
@ -339,7 +339,7 @@ class TestShowPhonePenalty:
|
||||
def test_update_phone_penalty_at_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test phone penalty unlocks when timer reaches zero."""
|
||||
@ -362,7 +362,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_adjusts_for_running(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen adjusts shutdown for running workout."""
|
||||
@ -380,7 +380,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_adjusts_for_strength(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen adjusts shutdown for strength workout."""
|
||||
@ -398,7 +398,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_adjusts_for_phone_verified(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen adjusts shutdown for phone-verified workout."""
|
||||
@ -416,7 +416,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_skips_adjustment_for_sick_day(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen does not adjust for sick day."""
|
||||
@ -434,7 +434,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_skips_adjustment_no_type(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen does not adjust when no workout type."""
|
||||
@ -452,7 +452,7 @@ class TestUnlockScreenShutdownAdjustment:
|
||||
def test_unlock_screen_handles_adjustment_failure(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen continues when adjustment fails."""
|
||||
|
||||
@ -17,7 +17,7 @@ class TestGetWirelessSerial:
|
||||
def test_returns_wireless_serial(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns ip:port serial for a wireless device."""
|
||||
@ -30,7 +30,7 @@ class TestGetWirelessSerial:
|
||||
def test_returns_none_when_adb_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when adb devices fails."""
|
||||
@ -42,7 +42,7 @@ class TestGetWirelessSerial:
|
||||
def test_returns_none_when_no_wireless_device(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when only USB devices are connected."""
|
||||
@ -55,7 +55,7 @@ class TestGetWirelessSerial:
|
||||
def test_skips_offline_wireless_device(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test skips offline wireless devices."""
|
||||
@ -72,7 +72,7 @@ class TestTryAdbConnect:
|
||||
def test_successful_connect(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful ADB connect."""
|
||||
@ -86,7 +86,7 @@ class TestTryAdbConnect:
|
||||
def test_failed_connect_unable(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test connect failure with 'unable' in output."""
|
||||
@ -100,7 +100,7 @@ class TestTryAdbConnect:
|
||||
def test_failed_connect_with_failed(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test connect failure with 'failed' in output."""
|
||||
@ -116,7 +116,7 @@ class TestTryAdbConnect:
|
||||
def test_no_connected_in_output(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test connect failure when 'connected' not in output."""
|
||||
@ -134,7 +134,7 @@ class TestGetLocalSubnetPrefix:
|
||||
def test_returns_prefix(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns first three octets of local IP."""
|
||||
@ -153,7 +153,7 @@ class TestGetLocalSubnetPrefix:
|
||||
def test_returns_none_on_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when socket raises OSError."""
|
||||
@ -172,7 +172,7 @@ class TestTryWirelessReconnect:
|
||||
def test_returns_false_when_no_prefix(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when subnet prefix can't be determined."""
|
||||
@ -184,7 +184,7 @@ class TestTryWirelessReconnect:
|
||||
def test_returns_true_when_probe_succeeds(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns True when a probe finds the phone."""
|
||||
@ -207,7 +207,7 @@ class TestTryWirelessReconnect:
|
||||
def test_returns_false_when_no_probe_succeeds(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when no probe finds the phone."""
|
||||
@ -225,7 +225,7 @@ class TestTryWirelessReconnect:
|
||||
def test_probe_connect_succeeds_but_no_device(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test probe passes socket but adb_connect succeeds without device."""
|
||||
@ -248,7 +248,7 @@ class TestTryWirelessReconnect:
|
||||
def test_probe_adb_connect_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test probe where socket connects but adb connect fails."""
|
||||
|
||||
@ -18,7 +18,7 @@ class TestApplyEarlierShutdown:
|
||||
def test_returns_false_when_no_config(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when config can't be read."""
|
||||
@ -29,7 +29,7 @@ class TestApplyEarlierShutdown:
|
||||
def test_returns_false_when_save_state_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when saving state fails."""
|
||||
@ -43,7 +43,7 @@ class TestApplyEarlierShutdown:
|
||||
def test_success_applies_earlier_hours(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful application of earlier shutdown hours."""
|
||||
@ -62,7 +62,7 @@ class TestApplyEarlierShutdown:
|
||||
def test_clamps_to_minimum_18(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test hours are clamped to minimum of 18."""
|
||||
@ -84,7 +84,7 @@ class TestAdjustShutdownTimeEarlier:
|
||||
def test_returns_false_when_sick_mode_used_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when sick mode already used today."""
|
||||
@ -98,7 +98,7 @@ class TestAdjustShutdownTimeEarlier:
|
||||
def test_success(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful adjustment."""
|
||||
@ -113,7 +113,7 @@ class TestAdjustShutdownTimeEarlier:
|
||||
def test_handles_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test handles OSError during apply."""
|
||||
@ -132,7 +132,7 @@ class TestAdjustShutdownTimeEarlier:
|
||||
def test_handles_value_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test handles ValueError during apply."""
|
||||
@ -155,7 +155,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_returns_false_when_no_config(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when config is missing."""
|
||||
@ -166,7 +166,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_success_applies_later_hours(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful later adjustment with restore flag."""
|
||||
@ -184,7 +184,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_clamps_to_max_23(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test hours are clamped to maximum of 23."""
|
||||
@ -201,7 +201,7 @@ class TestAdjustShutdownTimeLater:
|
||||
def test_handles_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test handles OSError."""
|
||||
@ -220,7 +220,7 @@ class TestSickModeUsedToday:
|
||||
def test_returns_false_when_no_file(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when state file doesn't exist."""
|
||||
@ -236,7 +236,7 @@ class TestSickModeUsedToday:
|
||||
def test_returns_true_when_used_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns True when state matches today."""
|
||||
@ -255,7 +255,7 @@ class TestSickModeUsedToday:
|
||||
def test_returns_false_when_different_date(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when state is from different date."""
|
||||
@ -271,7 +271,7 @@ class TestSickModeUsedToday:
|
||||
def test_returns_false_on_json_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False on JSONDecodeError."""
|
||||
@ -291,7 +291,7 @@ class TestSaveSickDayState:
|
||||
def test_saves_state_successfully(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test saves state file with correct content."""
|
||||
@ -311,7 +311,7 @@ class TestSaveSickDayState:
|
||||
def test_returns_false_on_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when write fails."""
|
||||
@ -332,7 +332,7 @@ class TestLoadSickDayState:
|
||||
def test_loads_valid_state(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test loads state with all fields present."""
|
||||
@ -357,7 +357,7 @@ class TestLoadSickDayState:
|
||||
def test_returns_none_when_fields_missing(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when required fields are missing."""
|
||||
@ -378,7 +378,7 @@ class TestWriteRestoredConfig:
|
||||
def test_restores_config_and_removes_state(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test restores config values and deletes state file."""
|
||||
@ -402,7 +402,7 @@ class TestWriteRestoredConfig:
|
||||
def test_still_removes_state_when_config_read_fails(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test removes state file even when config read returns None."""
|
||||
|
||||
@ -20,7 +20,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_no_state_file_does_nothing(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test does nothing when no state file exists."""
|
||||
@ -36,7 +36,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_restores_when_state_from_previous_day(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test restores config when state date differs from today."""
|
||||
@ -64,7 +64,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_does_not_restore_when_state_from_today(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test does not restore when state date matches today."""
|
||||
@ -95,7 +95,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_returns_when_loaded_state_is_none(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns early when loaded state is None."""
|
||||
@ -115,7 +115,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_handles_oserror(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test handles OSError when loading state."""
|
||||
@ -132,7 +132,7 @@ class TestRestoreOriginalConfigIfNeeded:
|
||||
def test_handles_json_decode_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test handles JSONDecodeError when loading state."""
|
||||
@ -152,7 +152,7 @@ class TestReadShutdownConfig:
|
||||
def test_returns_none_when_file_missing(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when config file doesn't exist."""
|
||||
@ -168,7 +168,7 @@ class TestReadShutdownConfig:
|
||||
def test_reads_valid_config(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test reads all three config values from file."""
|
||||
@ -185,7 +185,7 @@ class TestReadShutdownConfig:
|
||||
def test_returns_none_when_values_missing(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns None when config has missing keys."""
|
||||
@ -206,7 +206,7 @@ class TestBuildShutdownCmd:
|
||||
def test_without_restore(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test command without restore flag."""
|
||||
@ -223,7 +223,7 @@ class TestBuildShutdownCmd:
|
||||
def test_with_restore(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test command with restore flag."""
|
||||
@ -245,7 +245,7 @@ class TestWriteShutdownConfig:
|
||||
def test_returns_false_when_script_missing(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False when adjust script doesn't exist."""
|
||||
@ -262,7 +262,7 @@ class TestWriteShutdownConfig:
|
||||
def test_success_calls_run_shutdown_cmd(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful config write delegates to _run_shutdown_cmd."""
|
||||
@ -287,7 +287,7 @@ class TestRunShutdownCmd:
|
||||
def test_success(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test successful command execution."""
|
||||
@ -303,7 +303,7 @@ class TestRunShutdownCmd:
|
||||
def test_returns_false_on_subprocess_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test returns False on SubprocessError."""
|
||||
|
||||
@ -24,7 +24,7 @@ class TestUITransitions:
|
||||
def test_clear_container(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test clear_container destroys all child widgets."""
|
||||
@ -46,7 +46,7 @@ class TestUITransitions:
|
||||
def test_unlock_screen_saves_and_schedules_close(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test unlock_screen saves log and schedules close."""
|
||||
@ -62,7 +62,7 @@ class TestUITransitions:
|
||||
def test_lockout_starts_countdown(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test lockout initializes countdown timer."""
|
||||
@ -95,7 +95,7 @@ class TestTimerLogic:
|
||||
def test_update_lockout_countdown_decrements(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test countdown decrements remaining time."""
|
||||
@ -111,7 +111,7 @@ class TestTimerLogic:
|
||||
def test_update_lockout_countdown_at_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test countdown at zero returns to workout question."""
|
||||
@ -127,7 +127,7 @@ class TestTimerLogic:
|
||||
def test_update_submit_timer_countdown(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test submit timer counts down."""
|
||||
@ -145,7 +145,7 @@ class TestTimerLogic:
|
||||
def test_update_submit_timer_enables_when_filled(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test submit enabled when timer done and entries filled."""
|
||||
@ -165,7 +165,7 @@ class TestTimerLogic:
|
||||
def test_update_submit_timer_waits_for_entries(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test submit waits when entries not filled."""
|
||||
@ -184,7 +184,7 @@ class TestTimerLogic:
|
||||
def test_update_submit_timer_handles_tcl_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test timer handles TclError when widgets destroyed."""
|
||||
@ -199,7 +199,7 @@ class TestTimerLogic:
|
||||
def test_check_entries_filled_enables_submit(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test check_entries_filled enables submit when all filled."""
|
||||
@ -218,7 +218,7 @@ class TestTimerLogic:
|
||||
def test_check_entries_filled_continues_waiting(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test check_entries_filled continues waiting when not filled."""
|
||||
@ -236,7 +236,7 @@ class TestTimerLogic:
|
||||
def test_check_entries_filled_handles_tcl_error(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test check_entries_filled handles TclError."""
|
||||
@ -256,7 +256,7 @@ class TestAskWorkoutType:
|
||||
def test_ask_workout_type_creates_buttons(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_workout_type creates running and strength buttons."""
|
||||
@ -277,7 +277,7 @@ class TestAskRunningDetails:
|
||||
def test_ask_running_details_sets_workout_type(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_running_details sets workout type to running."""
|
||||
@ -293,7 +293,7 @@ class TestAskRunningDetails:
|
||||
def test_ask_running_details_creates_entry_fields(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_running_details creates entry fields."""
|
||||
@ -312,7 +312,7 @@ class TestAskRunningDetails:
|
||||
def test_ask_running_details_sets_timer(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_running_details initializes submit timer."""
|
||||
@ -332,7 +332,7 @@ class TestAskStrengthDetails:
|
||||
def test_ask_strength_details_sets_workout_type(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_strength_details sets workout type to strength."""
|
||||
@ -348,7 +348,7 @@ class TestAskStrengthDetails:
|
||||
def test_ask_strength_details_creates_entry_fields(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_strength_details creates entry fields."""
|
||||
@ -369,7 +369,7 @@ class TestAskStrengthDetails:
|
||||
def test_ask_strength_details_sets_timer(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_strength_details initializes submit timer."""
|
||||
@ -385,7 +385,7 @@ class TestAskStrengthDetails:
|
||||
def test_ask_strength_details_production_timer(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test production mode uses longer submit delay."""
|
||||
@ -404,7 +404,7 @@ class TestAskWorkoutDone:
|
||||
def test_ask_workout_done_creates_buttons(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test ask_workout_done creates yes/no buttons."""
|
||||
@ -422,7 +422,7 @@ class TestAskIfSick:
|
||||
"""Tests for ask_if_sick method."""
|
||||
|
||||
def test_ask_if_sick_displays_dialog(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test ask_if_sick shows sick day question."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -436,7 +436,7 @@ class TestSickQuestionButtons:
|
||||
"""Tests for _sick_question_buttons method."""
|
||||
|
||||
def test_creates_buttons(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test _sick_question_buttons creates yes/no buttons."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -448,7 +448,7 @@ class TestGetSickDayStatus:
|
||||
"""Tests for _get_sick_day_status method."""
|
||||
|
||||
def test_already_adjusted_today(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test status when sick mode already used today."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -460,7 +460,7 @@ class TestGetSickDayStatus:
|
||||
assert color == "#ffaa00"
|
||||
|
||||
def test_adjustment_success(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test status when shutdown time adjusted successfully."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -475,7 +475,7 @@ class TestGetSickDayStatus:
|
||||
assert color == "#00aa00"
|
||||
|
||||
def test_adjustment_failure(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test status when adjustment fails."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
|
||||
@ -18,7 +18,7 @@ class TestHandleSickDay:
|
||||
"""Tests for handle_sick_day method."""
|
||||
|
||||
def test_sets_up_countdown(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test handle_sick_day initializes sick day flow."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -38,7 +38,7 @@ class TestShowSickDayUi:
|
||||
"""Tests for _show_sick_day_ui method."""
|
||||
|
||||
def test_displays_ui(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test _show_sick_day_ui displays labels."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
|
||||
@ -17,7 +17,7 @@ class TestUpdateSickCountdownAtZero:
|
||||
def test_records_sick_day_and_unlocks_at_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test countdown at zero records sick day and calls unlock."""
|
||||
|
||||
@ -23,7 +23,7 @@ class TestVerifyRunningData:
|
||||
def test_valid_running_data(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test valid running data triggers unlock attempt."""
|
||||
@ -40,7 +40,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_distance_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test zero distance is rejected."""
|
||||
@ -56,7 +56,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_distance_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test distance over max is rejected."""
|
||||
@ -72,7 +72,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_time_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test zero time is rejected."""
|
||||
@ -88,7 +88,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_time_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test time over max is rejected."""
|
||||
@ -104,7 +104,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_pace_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test zero pace is rejected."""
|
||||
@ -120,7 +120,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_pace_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test pace over max is rejected."""
|
||||
@ -136,7 +136,7 @@ class TestVerifyRunningData:
|
||||
def test_pace_mismatch(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test pace mismatch is rejected."""
|
||||
@ -153,7 +153,7 @@ class TestVerifyRunningData:
|
||||
def test_invalid_number_format(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test non-numeric input is rejected."""
|
||||
@ -173,7 +173,7 @@ class TestVerifyStrengthData:
|
||||
def test_valid_strength_data(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test valid strength data triggers unlock attempt."""
|
||||
@ -190,7 +190,7 @@ class TestVerifyStrengthData:
|
||||
def test_valid_multiple_exercises(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test valid data with multiple exercises."""
|
||||
@ -210,7 +210,7 @@ class TestVerifyStrengthData:
|
||||
def test_mismatched_list_lengths(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test mismatched list lengths are rejected."""
|
||||
@ -229,7 +229,7 @@ class TestVerifyStrengthData:
|
||||
def test_short_exercise_name(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test short exercise names are rejected."""
|
||||
@ -245,7 +245,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_sets_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test zero sets is rejected."""
|
||||
@ -261,7 +261,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_sets_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test sets over max is rejected."""
|
||||
@ -277,7 +277,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_reps_zero(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test zero reps is rejected."""
|
||||
@ -293,7 +293,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_reps_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test reps over max is rejected."""
|
||||
@ -309,7 +309,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_weight_negative(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test negative weight is rejected."""
|
||||
@ -325,7 +325,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_weight_too_high(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test weight over max is rejected."""
|
||||
@ -341,7 +341,7 @@ class TestVerifyStrengthData:
|
||||
def test_total_weight_mismatch(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test total weight mismatch is rejected."""
|
||||
@ -357,7 +357,7 @@ class TestVerifyStrengthData:
|
||||
def test_invalid_format(
|
||||
self,
|
||||
mock_tk: MagicMock,
|
||||
_mock_sys_exit: MagicMock,
|
||||
mock_sys_exit: MagicMock,
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""Test invalid format is rejected."""
|
||||
@ -375,7 +375,7 @@ class TestVariableReps:
|
||||
"""Tests for variable reps format in strength verification."""
|
||||
|
||||
def test_valid_variable_reps(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test valid variable reps with + separator."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
@ -391,7 +391,7 @@ class TestVariableReps:
|
||||
locker._attempt_unlock.assert_called_once()
|
||||
|
||||
def test_variable_reps_count_mismatch(
|
||||
self, mock_tk: MagicMock, _mock_sys_exit: MagicMock, tmp_path: Path
|
||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||
) -> None:
|
||||
"""Test variable reps count not matching sets."""
|
||||
locker = create_locker(mock_tk, tmp_path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user