Verify real CBB BOM imports and handle first-open native database updates

This commit is contained in:
阿白叔 committed 2026-10-15 15:20:19 +08:00
1 parent a332e7bd59
commit 1b39d802bd
9 files changed
+504 -9

No files matched your search

+16
View File
@@ -80,6 +80,22 @@ def test_unknown_project_rejected_before_any_collection_or_save(batch, tmp_path)
assert not calls and all(not store.list_target_plan(task.task_id) for task in tasks)
@pytest.mark.parametrize('empty_inventory', [True, False])
def test_matching_failure_identifies_the_project_and_keeps_all_plans_empty(batch, tmp_path, empty_inventory):
service, store, tasks, targets, calls = batch
records = list(records_for(tasks, targets))
if empty_inventory:
service.for_project_task(tasks[0].task_id)._quick_run_preparer.collect_inventory = lambda *a: ()
else:
records[0]['refdes'] = 'R9'
path = write_bom_template(tmp_path / 'unmatched.xlsx', records)
with pytest.raises(TaskCenterError) as caught:
service.preview_bom_batch(tasks[0].task_id, path)
assert tasks[0].name in caught.value.message
assert str(targets[tasks[0].task_id][0].project_path) in caught.value.message
assert all(not store.list_target_plan(task.task_id) for task in tasks)
def test_missing_project_is_ambiguous_for_batch_and_never_guessed(batch, tmp_path):
service, store, tasks, targets, calls = batch
path = write_bom_template(tmp_path / 'missing-project.xlsx',