Skip to content

Commit bc5c3b0

Browse files
authored
Merge pull request #30 from cryptopoly/fix/runtime-paths-test-platform
Pin sys.platform=win32 in legacy-Tauri-extras test
2 parents 6094c2e + b402223 commit bc5c3b0

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

tests/test_setup_routes.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ def test_env_extras_are_inserted_on_sys_path(self):
3434
sys.path[:] = original_sys_path
3535

3636
def test_legacy_tauri_app_data_extras_are_import_candidates(self):
37+
# ``_user_data_base`` only consults ``LOCALAPPDATA`` when
38+
# ``sys.platform == "win32"``. On macOS dev boxes and the
39+
# ubuntu-latest CI runner that branch is skipped, so just
40+
# patching the env var leaves the legacy candidate path
41+
# rooted at the host's real ``~/Library/Application Support``
42+
# / ``~/.local/share`` instead of the temp dir we created
43+
# below — and the assertion fails because the legacy dir we
44+
# mkdir'd isn't where the helper looks. Patch
45+
# ``sys.platform`` to ``win32`` for the duration of this test
46+
# so the Windows branch is exercised regardless of host OS.
47+
from backend_service import runtime_paths
3748
from backend_service.runtime_paths import ensure_extras_on_sys_path
3849

3950
tag = f"cp{sys.version_info.major}{sys.version_info.minor}"
@@ -42,11 +53,12 @@ def test_legacy_tauri_app_data_extras_are_import_candidates(self):
4253
legacy.mkdir(parents=True)
4354
original_sys_path = list(sys.path)
4455
try:
45-
with mock.patch.dict(
46-
os.environ,
47-
{"LOCALAPPDATA": tmp, "CHAOSENGINE_EXTRAS_SITE_PACKAGES": ""},
48-
clear=False,
49-
):
56+
with mock.patch.object(runtime_paths.sys, "platform", "win32"), \
57+
mock.patch.dict(
58+
os.environ,
59+
{"LOCALAPPDATA": tmp, "CHAOSENGINE_EXTRAS_SITE_PACKAGES": ""},
60+
clear=False,
61+
):
5062
inserted = ensure_extras_on_sys_path()
5163
self.assertIn(legacy, inserted)
5264
self.assertIn(str(legacy), sys.path)

0 commit comments

Comments
 (0)