Skip to content

Commit bd75bff

Browse files
committed
Add platform skip markers for Windows-only tests
1 parent edc5829 commit bd75bff

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

tests/unit/test_launcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import pytest
1313

14+
pytestmark = pytest.mark.skipif(sys.platform != "win32", reason="Windows-only")
15+
1416

1517
@pytest.fixture
1618
def mock_popen(monkeypatch):

tests/unit/test_platform.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ def fake_kill(pid, sig):
908908
assert 42 in result
909909
assert (42, signal.SIGKILL) in signals_sent
910910

911+
@pytest.mark.skipif(not hasattr(signal, "CTRL_BREAK_EVENT"), reason="Windows-only signal")
911912
def test_kill_pids_sends_ctrl_break_on_windows(self, monkeypatch):
912913
"""On Windows, sends CTRL_BREAK_EVENT."""
913914
import signal
@@ -927,6 +928,7 @@ def fake_kill(pid, sig):
927928
assert 42 in result
928929
assert (42, signal.CTRL_BREAK_EVENT) in signals_sent
929930

931+
@pytest.mark.skipif(not hasattr(signal, "CTRL_BREAK_EVENT"), reason="Windows-only signal")
930932
def test_kill_pids_force_kills_with_taskkill(self, monkeypatch):
931933
"""On Windows, uses taskkill /F when pid survives CTRL_BREAK."""
932934
import signal

tests/unit/test_tray.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,14 @@ def test_build_menu_with_mounts(self, tray_app, fake_pystray):
111111
assert menu.items[0].text == "D: - image.hdf"
112112

113113
def test_build_menu_mount_label_format(self, tray_app, fake_pystray):
114-
"""Label format is 'D: - image.hdf'."""
114+
"""Label format is 'E: - work.adf'."""
115+
# Use a platform-appropriate path so Path().name extracts just the filename
116+
if sys.platform == "win32":
117+
image_path = "C:\\disks\\work.adf"
118+
else:
119+
image_path = "/disks/work.adf"
115120
tray_app._mounts = [
116-
{"pid": 100, "mountpoint": "E:", "image": "C:\\disks\\work.adf"},
121+
{"pid": 100, "mountpoint": "E:", "image": image_path},
117122
]
118123
menu = tray_app._build_menu()
119124
assert menu.items[0].text == "E: - work.adf"
@@ -289,6 +294,7 @@ def fake_find():
289294
# ---------------------------------------------------------------------------
290295

291296

297+
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-only: ctypes.windll")
292298
class TestSingleInstance:
293299
def test_single_instance_acquired(self, monkeypatch):
294300
"""CreateMutexW succeeds, GetLastError != 183."""
@@ -519,6 +525,7 @@ def test_mount_label_uses_image_key(self, tray_app, fake_pystray):
519525
assert "game.hdf" in mount_label
520526

521527

528+
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-only: pythonw.exe logic")
522529
class TestInspectUsesPythonExe:
523530
def test_inspect_uses_python_exe(self, tray_app, fake_pystray, monkeypatch):
524531
"""Inspect resolves python.exe not pythonw.exe/sys.executable."""

tests/unit/test_windows_shell.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
import pytest
1515

16+
pytestmark = pytest.mark.skipif(sys.platform != "win32", reason="Windows-only")
17+
1618

1719
# ---------------------------------------------------------------------------
1820
# Fake winreg implementation

0 commit comments

Comments
 (0)