fix: inspect native ICDB occupancy before bounded repair

This commit is contained in:
阿白叔 committed 2026-11-04 12:26:09 +08:00
1 parent cb1326688b
commit e14a864b37
17 files changed
+617 -153

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import subprocess
import pytest
def test_wmi_timeout_is_unknown_not_idle(monkeypatch):
from cbb_refresh_verify.owner_probe import query_owners
def hang(command, **kw):
assert 0 < kw['timeout'] <= 10
raise subprocess.TimeoutExpired(command, kw['timeout'])
monkeypatch.setattr(subprocess, 'run', hang)
with pytest.raises(RuntimeError, match='OWNER_QUERY_TIMEOUT'):
query_owners(['ExpeditionPCB.exe'])
def test_malformed_wmi_response_is_not_empty_owner_list(monkeypatch):
from cbb_refresh_verify.owner_probe import query_owners
from pathlib import Path
def run(command, **kw):
Path(command[-1]).with_name('result.json').write_text('{}')
return subprocess.CompletedProcess(command, 0)
monkeypatch.setattr(subprocess, 'run', run)
with pytest.raises(RuntimeError, match='OWNER_QUERY_UNCONFIRMED'):
query_owners(['ExpeditionPCB.exe'])