Update Windows Mocking for Tests

This commit is contained in:
David Sangrey committed 2026-01-27 23:43:03 -05:00
1 parent 572afe8dc4
commit 47b54e3f99
4 files changed
+9 -1

No files matched your search

+2 -1
View File
@@ -32,6 +32,7 @@ jobs:
python-version-file: '.python-version'
- name: Install dependencies
run: |
sudo apt-get install -y xvfb
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
@@ -79,4 +80,4 @@ jobs:
####################################################################
- name: PyTest tests
run: |
pytest
xvfb-run pytest
+2
View File
@@ -4,6 +4,7 @@
import pytest
import json
import sys
from unittest.mock import MagicMock, patch
import dashboard
@@ -30,6 +31,7 @@ class TestDashboard:
)
return d
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-specific logic")
def test_start_logic_windows(self, mock_root, temp_journal_dir):
"""Verify observer setup on Windows platform."""
with patch("sys.platform", "win32"), patch(
+2
View File
@@ -4,6 +4,7 @@
import pytest
from unittest.mock import patch
import sys
import l10n
@@ -101,6 +102,7 @@ class TestLocaleUtils:
assert l10n.Locale.number_from_string("100") == 100
assert l10n.Locale.number_from_string("not_a_number") is None
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-specific logic")
def test_preferred_languages_mapping(self):
"""Verify the zh-CN to zh-Hans hack works."""
with patch("sys.platform", "win32"):
+3
View File
@@ -2,6 +2,8 @@
# mypy: ignore-errors
"""Test util_ships."""
import pytest
import sys
from unittest.mock import patch
import util_ships
@@ -22,6 +24,7 @@ class TestShipUtils:
assert util_ships.ship_file_name("MyShip.txt", "Sidewinder") == "MyShip"
assert util_ships.ship_file_name("Config.json", "CobraMkIII") == "Config"
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-specific logic")
@patch("sys.platform", "win32")
@patch("os.path.isreserved")
def test_ship_file_name_reserved_windows(self, mock_isreserved):