Skip to content

Commit cff4557

Browse files
AreteDriverclaude
andcommitted
test(platform): add Windows factory branch coverage
- Added 6 tests for Windows branches of factory functions - platform/__init__.py: 82% → 100% - 1803 tests passing (+6) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 97db76e commit cff4557

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

tests/test_platform.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,85 @@ def test_get_eve_logs_paths_returns_paths(self):
10511051
assert all("Gamelogs" in str(p) for p in paths)
10521052

10531053

1054+
class TestWindowsFactoryBranches:
1055+
"""Tests for Windows branches of factory functions (mocked)."""
1056+
1057+
def test_get_platform_name_windows(self):
1058+
"""Test get_platform_name returns windows on win32."""
1059+
from argus_overview.platform import get_platform_name
1060+
1061+
with patch.object(sys, "platform", "win32"):
1062+
assert get_platform_name() == "windows"
1063+
1064+
def test_get_window_manager_windows_branch(self):
1065+
"""Test get_window_manager Windows branch is reachable."""
1066+
# Create mock Windows classes
1067+
mock_wm_class = MagicMock()
1068+
mock_windows_module = MagicMock()
1069+
mock_windows_module.WindowManagerWindows = mock_wm_class
1070+
1071+
# The function imports inside the if branch, so we need to mock the import
1072+
with patch.object(sys, "platform", "win32"):
1073+
with patch.dict(sys.modules, {"argus_overview.platform.windows": mock_windows_module}):
1074+
# Need to re-import since we're testing the import path
1075+
from argus_overview.platform import get_window_manager
1076+
1077+
_ = get_window_manager()
1078+
mock_wm_class.assert_called_once()
1079+
1080+
def test_get_window_capture_windows_branch(self):
1081+
"""Test get_window_capture Windows branch is reachable."""
1082+
mock_wc_class = MagicMock()
1083+
mock_windows_module = MagicMock()
1084+
mock_windows_module.WindowCaptureWindows = mock_wc_class
1085+
1086+
with patch.object(sys, "platform", "win32"):
1087+
with patch.dict(sys.modules, {"argus_overview.platform.windows": mock_windows_module}):
1088+
from argus_overview.platform import get_window_capture
1089+
1090+
_ = get_window_capture(max_workers=2)
1091+
mock_wc_class.assert_called_once_with(max_workers=2)
1092+
1093+
def test_get_screen_manager_windows_branch(self):
1094+
"""Test get_screen_manager Windows branch is reachable."""
1095+
mock_sm_class = MagicMock()
1096+
mock_windows_module = MagicMock()
1097+
mock_windows_module.ScreenManagerWindows = mock_sm_class
1098+
1099+
with patch.object(sys, "platform", "win32"):
1100+
with patch.dict(sys.modules, {"argus_overview.platform.windows": mock_windows_module}):
1101+
from argus_overview.platform import get_screen_manager
1102+
1103+
_ = get_screen_manager()
1104+
mock_sm_class.assert_called_once()
1105+
1106+
def test_get_eve_path_resolver_windows_branch(self):
1107+
"""Test get_eve_path_resolver Windows branch is reachable."""
1108+
mock_resolver_class = MagicMock()
1109+
mock_windows_module = MagicMock()
1110+
mock_windows_module.EVEPathResolverWindows = mock_resolver_class
1111+
1112+
with patch.object(sys, "platform", "win32"):
1113+
with patch.dict(sys.modules, {"argus_overview.platform.windows": mock_windows_module}):
1114+
from argus_overview.platform import get_eve_path_resolver
1115+
1116+
_ = get_eve_path_resolver()
1117+
mock_resolver_class.assert_called_once()
1118+
1119+
def test_get_hotkey_helper_windows_branch(self):
1120+
"""Test get_hotkey_helper Windows branch is reachable."""
1121+
mock_helper_class = MagicMock()
1122+
mock_windows_module = MagicMock()
1123+
mock_windows_module.HotkeyHelperWindows = mock_helper_class
1124+
1125+
with patch.object(sys, "platform", "win32"):
1126+
with patch.dict(sys.modules, {"argus_overview.platform.windows": mock_windows_module}):
1127+
from argus_overview.platform import get_hotkey_helper
1128+
1129+
_ = get_hotkey_helper()
1130+
mock_helper_class.assert_called_once()
1131+
1132+
10541133
class TestWindowCaptureLinuxEdgeCases:
10551134
"""Edge case tests for WindowCaptureLinux."""
10561135

0 commit comments

Comments
 (0)