"""An engine package must carry every library its binaries import, except the OS's and the GPU driver's. Tester report 2026-10-17: a clean Windows 11 PC failed with 0xC0000135 because strata.exe imports cublas64_13.dll and the package did not hold it (the build PC had the CUDA Toolkit on PATH, which hid the problem). These tests build tiny real PE files, so they run anywhere and need no GPU or toolkit.""" import os import struct import sys import tempfile import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT / "packaging")) import binary_deps # noqa: E402 import package_engine # noqa: E402 def make_pe(imports, delay=()): """A minimal PE32+ file with a .idata section that imports the named DLLs (and delay-loads `delay`).""" va, raw = 0x1000, 0x400 body = bytearray() descriptors = (len(imports) + 1) * 20 delays = (len(delay) + 1) * 32 names_at = descriptors + delays name_rvas = [] blob = bytearray() for n in list(imports) + list(delay): name_rvas.append(va + names_at + len(blob)) blob += n.encode("ascii") + b"\0" for i, _ in enumerate(imports): body += struct.pack("