fix: keep the post-save release result through slow file probes

This commit is contained in:
阿白叔 committed 2026-11-25 11:19:34 +08:00
1 parent 2e87627ef1
commit edd1e088af
2 files changed
+36 -3

No files matched your search

+31
View File
@@ -46,3 +46,34 @@ def test_batch_waits_for_recorded_save_past_ordinary_release_deadline(tmp_path,
monkeypatch.setattr(context.stop, 'wait', lambda interval: waiting.append(interval))
verify_runner.wait_for_batch_release(request, context, timeout_seconds=0)
assert len(waiting) == 1
def test_completed_save_keeps_bounded_release_probe_alive(tmp_path, monkeypatch):
from contextlib import contextmanager
from threading import Event
from cbb_refresh_verify.icdb_ownership import wait_for_saved_database_release
entered, finish = Event(), Event()
@contextmanager
def probe(*args, **kwargs):
entered.set()
assert finish.wait(1)
yield {'exclusive_files': [str(tmp_path/'icdb.dat')]}
monkeypatch.setattr('cbb_refresh_verify.file_probe.hold_release_files', probe)
context = BatchTaskContext(str(tmp_path/'library.lmc'))
from threading import Thread
def finish_probe():
assert entered.wait(1)
Event().wait(.15)
finish.set()
thread = Thread(target=finish_probe)
thread.start()
try:
result = context.run(lambda: wait_for_saved_database_release(context.library,
tmp_path/'project.prj', tmp_path/'project.pcb'), timeout_seconds=.05)
assert result['status'] == 'RELEASE_CONFIRMED'
finally:
finish.set()
thread.join()