fix: allow bounded full-library release scans to complete

This commit is contained in:
阿白叔 committed 2026-11-25 11:25:06 +08:00
1 parent edd1e088af
commit 0ee24d7beb
2 files changed
+49 -23

No files matched your search

+21
View File
@@ -343,3 +343,24 @@ def test_probe_timeout_reports_last_io_phase_and_path(tmp_path, monkeypatch):
with pytest.raises(TimeoutError, match=r'FILE_PROBE_TIMEOUT.*open_exclusive.*SymbolLibs/icdb.dat'):
with file_probe.hold_release_files(library, timeout_seconds=.7):
pytest.fail('a timed-out probe cannot prove release')
def test_full_library_probe_budget_accounts_for_both_tree_scans(tmp_path, monkeypatch):
from cbb_refresh_verify import file_probe
from types import SimpleNamespace
class Process:
stdin = SimpleNamespace(close=lambda: None)
def wait(self, *_):
return 0
def poll(self):
return None
monkeypatch.setattr(file_probe.subprocess, 'Popen', lambda *a, **k: Process())
ticks = iter([0., 11., 31., 32.])
monkeypatch.setattr(file_probe.time, 'monotonic', lambda: next(ticks))
monkeypatch.setattr(file_probe.time, 'sleep', lambda _: None)
with pytest.raises(TimeoutError, match=r'FILE_PROBE_TIMEOUT.*32.0s'):
with file_probe.hold_release_files(tmp_path/'lib.lmc'):
pytest.fail('the fake probe never returns a receipt')