fix: harden PCB and iCDB verification lifecycle for beta release
This commit is contained in:
1 parent
11a2b2e46e
commit
a11eb3c766
33 files changed
+1226
-267
No files matched your search
+11
-11
@@ -212,12 +212,12 @@ def test_preflight_uses_project_pcb_reference_not_block_name(tmp_path):
|
||||
assert preflight(request(tmp_path)) == (work/'CBB1.prj', work/'PCB'/'actual.pcb')
|
||||
|
||||
|
||||
def test_preflight_preserves_mapped_drive_without_resolve(tmp_path, monkeypatch):
|
||||
def test_preflight_uses_canonical_paths_for_safety_but_preserves_mentor_path(tmp_path, monkeypatch):
|
||||
work = fixture(tmp_path)
|
||||
monkeypatch.setattr(
|
||||
Path,
|
||||
'resolve',
|
||||
lambda self: pytest.fail(f'preflight must preserve mapped drive: {self}'),
|
||||
lambda self: Path(str(self).replace(str(tmp_path), str(tmp_path/'canonical-share'))),
|
||||
)
|
||||
|
||||
assert preflight(request(tmp_path)) == (work/'CBB1.prj', work/'PCB'/'actual.pcb')
|
||||
@@ -458,18 +458,18 @@ def test_batch_continues_past_item_failure_and_logs_all_items(tmp_path):
|
||||
assert [r.status for r in results] == ['BLOCKED','FAIL','PASS']
|
||||
|
||||
|
||||
def test_batch_does_not_stop_for_timeout_failure(tmp_path):
|
||||
def test_batch_stops_for_unsafe_timeout_failure(tmp_path):
|
||||
calls = []
|
||||
outcomes = [VerifyResult('TIMEOUT', stderr='PCB remains open', safe_to_continue=False), VerifyResult('PASS')]
|
||||
def verify(req):
|
||||
calls.append(req.block_name)
|
||||
return outcomes.pop(0)
|
||||
results = run_batch([request(tmp_path, n) for n in ['A','B']], verifier=verify)
|
||||
assert calls == ['A','B']
|
||||
assert [r.status for r in results] == ['TIMEOUT','PASS']
|
||||
assert calls == ['A']
|
||||
assert [r.status for r in results] == ['TIMEOUT','SKIPPED']
|
||||
|
||||
|
||||
def test_batch_continues_when_verifier_raises(tmp_path):
|
||||
def test_batch_stops_when_verifier_raises(tmp_path):
|
||||
calls = []
|
||||
|
||||
def verify(req):
|
||||
@@ -479,10 +479,10 @@ def test_batch_continues_when_verifier_raises(tmp_path):
|
||||
return VerifyResult('PASS')
|
||||
|
||||
results = run_batch([request(tmp_path, n) for n in ['A', 'B']], verifier=verify)
|
||||
assert calls == ['A', 'B']
|
||||
assert calls == ['A']
|
||||
assert results[0].status == 'FAIL'
|
||||
assert 'unexpected worker error' in results[0].stderr
|
||||
assert results[1].status == 'PASS'
|
||||
assert results[1].status == 'SKIPPED'
|
||||
|
||||
|
||||
def test_batch_cancel_between_items(tmp_path):
|
||||
@@ -499,7 +499,7 @@ def test_parallelism_rejected_for_shared_library(tmp_path):
|
||||
run_batch([], max_workers=2)
|
||||
|
||||
|
||||
def test_timeout_terminates_worker_job_before_next_item(tmp_path, monkeypatch):
|
||||
def test_timeout_stops_automation_and_blocks_next_item(tmp_path, monkeypatch):
|
||||
"""A timed-out item must not leave a Mentor process holding the library."""
|
||||
fixture(tmp_path)
|
||||
killed = []
|
||||
@@ -521,7 +521,7 @@ def test_timeout_terminates_worker_job_before_next_item(tmp_path, monkeypatch):
|
||||
|
||||
assert result.status == 'TIMEOUT'
|
||||
assert killed == [True]
|
||||
assert result.safe_to_continue
|
||||
assert not result.safe_to_continue
|
||||
|
||||
|
||||
def test_fatal_dialog_terminates_current_worker_and_cannot_become_pass(tmp_path, monkeypatch):
|
||||
@@ -1013,7 +1013,7 @@ def test_saved_closed_without_cert_uses_bridge_and_never_reexecutes_verify(
|
||||
def close(self): ordering.append('worker_close')
|
||||
monkeypatch.setattr('cbb_refresh_verify.desktop_worker.DesktopWorker',FinishedWorker)
|
||||
monkeypatch.setattr('cbb_refresh_verify.verify_runner._cleanup_session_processes',
|
||||
lambda *a,**kw: ordering.append('cleanup'))
|
||||
lambda *a,**kw: (ordering.append('cleanup') or {'safe_to_continue': True}))
|
||||
monkeypatch.setattr('cbb_refresh_verify.verify_diagnostics.capture_failure_logs_with_timeout',
|
||||
lambda *_: ordering.append('failure_logs'))
|
||||
waits=[]
|
||||
|
||||
Reference in new issue
Block a user