Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(doctor): keep the Windows linkage probe portable in tests

Kenneth-Javier Ortigoza36378ea185d1
diff --git a/c/doctor.py b/c/doctor.py
index 02d8c2a6..6ec6cc87 100644
--- a/c/doctor.py
+++ b/c/doctor.py
@@ -351,7 +351,13 @@ def cuda_linkage(engine_path):
engine = Path(engine_path)
if not engine.is_file():
return {"linked": False, "missing": False}
- if os.name == "posix":
+ # `sys.platform` alone selects the branch, so a test can exercise the
+ # Windows probe on a POSIX host by faking it. Faking `os.name` instead
+ # would repoint pathlib at Windows semantics and turn the POSIX fixture
+ # path into a WindowsPath that no longer resolves, so `is_file()` above
+ # would return early. On every real host the two agree and this reads
+ # exactly as `os.name == "posix"` did.
+ if os.name == "posix" and sys.platform != "win32":
try:
result = subprocess.run(["ldd", str(engine)], capture_output=True, text=True,
timeout=3, check=False)
diff --git a/c/tests/test_doctor.py b/c/tests/test_doctor.py
index 418a734f..3f08df12 100644
--- a/c/tests/test_doctor.py
+++ b/c/tests/test_doctor.py
@@ -177,8 +177,12 @@ class DoctorTest(unittest.TestCase):
return engine
def _win_linkage(self, engine):
- with mock.patch.object(sys, "platform", "win32"), \
- mock.patch.object(os, "name", "nt"):
+ # Only sys.platform is faked. Faking os.name as well would make
+ # pathlib build a WindowsPath from the POSIX fixture path, which does
+ # not resolve on Linux/macOS, so cuda_linkage would bail at its
+ # is_file() guard before reaching the backend-marker logic and every
+ # assertion below would compare against a false negative.
+ with mock.patch.object(sys, "platform", "win32"):
return cuda_linkage(engine)
def test_windows_cuda_host_accepts_its_own_backend(self):