"""Platform guards for the community-supported native macOS install path.""" from __future__ import annotations import importlib.util from pathlib import Path ROOT = Path(__file__).resolve().parents[1] SPEC = importlib.util.spec_from_file_location("nexus_sync_macos_test", ROOT / "bin" / "sync.py") assert SPEC and SPEC.loader sync = importlib.util.module_from_spec(SPEC) SPEC.loader.exec_module(sync) def test_darwin_uses_gpu_agnostic_requirements(monkeypatch): monkeypatch.setattr(sync.os, "name", "posix") monkeypatch.setattr(sync.sys, "platform", "darwin") assert sync.requirements() == "requirements-base.txt" def test_linux_provisioning_stages_are_skipped_on_darwin(monkeypatch): monkeypatch.setattr(sync.sys, "platform", "darwin") def unexpected_run(*args, **kwargs): raise AssertionError(f"Linux provisioning ran on macOS: {args!r}") monkeypatch.setattr(sync.subprocess, "run", unexpected_run) sync.linux_stage("restore-linux.sh", "packages") def test_macos_installer_is_in_the_shell_parse_gate(): gate = (ROOT / "bin" / "check.sh").read_text(encoding="utf-8") assert "install-macos.sh" in gate