Files
阿白叔 11a2b2e46e Import CBB refresh verify r4 stability baseline
Preserve tested Verify source, authoritative READY checks, bounded bridge retries, diagnostics and failure-only reporting. Include 336-test suite and packaging assets; exclude live Mentor samples, field logs, backups and distributions.
2026-09-29 15:05:20 +08:00

37 lines
1.2 KiB
Python

from pathlib import Path
from cbb_refresh_verify.mentor_paths import discover_sdd_home
def _install(root: Path):
sdd = root / 'Mentor' / '7.9.5EE' / 'SDD_HOME'
for relative in (
'lm/win32/bin/LibraryManager.exe',
'lm/win32/bin/ReuseBlockImporter.exe',
'common/win32/bin/ExpeditionPCB.exe',
):
path = sdd / relative
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(b'fixture')
return sdd
def test_discover_sdd_home_finds_common_mentor_layout(tmp_path):
expected = _install(tmp_path)
assert discover_sdd_home(environ={}, search_roots=(tmp_path,)) == expected
def test_discover_sdd_home_prefers_explicit_installation(tmp_path):
expected = _install(tmp_path / 'explicit')
_install(tmp_path / 'other')
assert discover_sdd_home(str(expected / 'lm' / 'win32' / 'bin'), environ={},
search_roots=(tmp_path / 'other', tmp_path / 'explicit')) == expected
def test_discover_sdd_home_returns_none_without_known_mentor_binaries(tmp_path):
(tmp_path / 'Mentor' / '7.9.5EE' / 'SDD_HOME').mkdir(parents=True)
assert discover_sdd_home(environ={}, search_roots=(tmp_path,)) is None