fix: report known catalog conflicts before WMI startup

This commit is contained in:
阿白叔 committed 2026-11-25 11:53:07 +08:00
1 parent 0ee24d7beb
commit 75612cd4da
4 files changed
+88 -17

No files matched your search

+12 -13
View File
@@ -326,20 +326,19 @@ def test_recovery_scope_uses_interrupted_block_instead_of_new_selection(tmp_path
def test_probe_timeout_reports_last_io_phase_and_path(tmp_path, monkeypatch):
from cbb_refresh_verify import file_probe
import sys
script = tmp_path/'slow_probe.py'
from pathlib import Path
from types import SimpleNamespace
library = tmp_path/'lib.lmc'
script.write_text(
"import json, sys, time\n"
"from pathlib import Path\n"
"job = Path(sys.argv[-1])\n"
"job.with_name('progress.json').write_text(json.dumps("
"{'stage': 'open_exclusive', 'path': 'SymbolLibs/icdb.dat'}))\n"
"time.sleep(30)\n",
encoding='utf-8')
start = file_probe.subprocess.Popen
monkeypatch.setattr(file_probe.subprocess, 'Popen',
lambda command, **kwargs: start([sys.executable, str(script), command[-1]], **kwargs))
def start(command, **kwargs):
Path(command[-1]).with_name('progress.json').write_text(
'{"stage": "open_exclusive", "path": "SymbolLibs/icdb.dat"}', 'utf-8')
return SimpleNamespace(stdin=SimpleNamespace(close=lambda: None), wait=lambda _: 0)
monkeypatch.setattr(file_probe.subprocess, 'Popen', start)
ticks = iter([0., 1., 1.])
monkeypatch.setattr(file_probe.time, 'monotonic', lambda: next(ticks))
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')