From 37a458e3c38e0373942136494977d700f4ec26d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD=E5=8F=94?= <11794527+absfan@user.noreply.gitee.com> Date: Thu, 5 Nov 2026 14:05:03 +0800 Subject: [PATCH] test: tighten PR21 review regression evidence --- docs/testing/2026-11-05-pr21-review-fixes.md | 4 ++-- tests/trial_task_center/test_bom_import_review.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/testing/2026-11-05-pr21-review-fixes.md b/docs/testing/2026-11-05-pr21-review-fixes.md index f351308..344b277 100644 --- a/docs/testing/2026-11-05-pr21-review-fixes.md +++ b/docs/testing/2026-11-05-pr21-review-fixes.md @@ -20,8 +20,8 @@ 本轮仅验证新增修复及直接相关功能,不重跑整个仓库,也不重复真实 CAD/PCB。原始真实替换验收仍见 `2026-11-05-item-value-bom-native.md`。 -- 修复前先运行新复现文件:`test_bom_import_review.py` 的原始 9 项全部失败;修复后 9 项全部通过。随后补齐连续占用、名称冲突和匹配原因用例。 -- `python -m pytest -q tests/trial_task_center/test_bom_import_review.py tests/trial_task_center/test_item_value_and_bom_sources.py tests/v1_1/test_bom_sources_supervision.py --tb=short`:**44 passed**,涵盖 14 项审查回归、24 项既有策略/多来源验证、6 项监督验证。 +- 修复前先运行新复现文件:`test_bom_import_review.py` 原有 9 项全部失败;修复后原有 9 项全部通过,并补齐连续占用、名称冲突和匹配原因用例。当前该文件共 **14 个用例**。 +- `python -m pytest -q tests/trial_task_center/test_bom_import_review.py tests/trial_task_center/test_item_value_and_bom_sources.py tests/v1_1/test_bom_sources_supervision.py --tb=short`:**44 passed**,涵盖 14 项审查回归、24 项既有策略/多来源验证、7 项监督验证(测试集合存在重叠,不累加)。 - 模板、旧 BOM、料号类型、CBB 和两个模板导出入口的定向命令:**34 passed**,其中新增模板契约 8 项。 - 监督协议、结果处理和新监督入口:**22 passed**。与上面的 44 项存在 6 项重叠,不累加。 - 报告、诊断包和历史保留相邻用例首轮:**37 passed、1 failed、1 error**。第一项 UI 用例仍拦截旧的检查接口,首轮异步等待超时,未结束的任务影响了后一项的占用检查;单独定位还发现按钮尚未启用就点击的问题。两项现已通过真实的新入口、使用无 CAD 的运行时替身,并明确等待按钮可用。 diff --git a/tests/trial_task_center/test_bom_import_review.py b/tests/trial_task_center/test_bom_import_review.py index 933d65f..8e20dc8 100644 --- a/tests/trial_task_center/test_bom_import_review.py +++ b/tests/trial_task_center/test_bom_import_review.py @@ -173,6 +173,7 @@ def test_single_lease_covers_source_read_and_inspection(case, tmp_path, monkeypa from dx_productivity.trial_task_center.service import _quick_run_lease checked = [] + operations = [] def assert_busy(): with pytest.raises(TaskCenterError) as failure: with _quick_run_lease(case.root): @@ -190,9 +191,15 @@ def test_single_lease_covers_source_read_and_inspection(case, tmp_path, monkeypa return original_inspect(*args, **kwargs) monkeypatch.setattr(workspace, 'load_sources', load) monkeypatch.setattr(inspection, 'inspect_batch', inspect) + original_operation = case.service._idle_quick_run_operation + def operation(name, task_id, action, **kwargs): + operations.append(name) + return original_operation(name, task_id, action, **kwargs) + monkeypatch.setattr(case.service, '_idle_quick_run_operation', operation) report = case.service.preview_bom_sources(case.tasks[0].task_id, (source(tmp_path / 'source.xlsx'),), runtime=case.runtime) assert report.passed_rows == 1 and checked == ['read', 'inspect'] + assert operations == ['preview_bom_sources'] with _quick_run_lease(case.root): pass