fix: 完善 UT 覆盖,统一 pytest 测试发现 - Closes #2
CI / test (pull_request) Successful in 9s

- 新建 pytest.ini 统一 test discovery(tests/ + skills/ir_generation_skill/tests/)
- test_step1~3 转换为 pytest 兼容格式,无输出文件时自动 skip
- 新增 tests/test_detect_conflicts.py(18 个纯函数单测)
- 新增 tests/test_config.py(7 个配置模块单测)
- CI 改为 pytest -v 使用 pytest.ini testpaths
- DEV_AGENT.md 新增 PR 提交规范

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 00:07:07 +08:00
parent 618364e744
commit 682dedb4b4
11 changed files with 619 additions and 32 deletions
+15 -9
View File
@@ -258,21 +258,27 @@ def acceptance_runs(request) -> int:
def run_ir_pipeline():
"""Return a callable that runs the IR generation pipeline on a parsed JSON.
Returns None if the pipeline script is not available in the current environment.
This is common when the acceptance tests run on pre-generated IR output.
Usage::
ir_data, ir_path = run_ir_pipeline(parsed_json_path, output_dir)
runner = run_ir_pipeline()
if runner:
ir_data, ir_path = runner(parsed_json_path, output_dir)
"""
sys.path.insert(0, _skill_path("ir_generation_skill"))
ir_gen_path = (
_PROJECT_ROOT / "skills" / "ir_generation_skill" / "scripts" / "ir_generator.py"
)
if not ir_gen_path.exists():
return None
sys.path.insert(0, str(ir_gen_path.parent))
from ir_generator import generate_ir
def _run(parsed_path: str, output_dir: str | None = None) -> tuple[dict, str]:
"""Run IR generation and return (ir_data, ir_path)."""
def _run(parsed_path: str, output_dir: str | None = None) -> tuple[list, str]:
out = output_dir or tempfile.mkdtemp(prefix="qe_acceptance_")
result = generate_ir(parsed_path, out, dry_run=False)
ir_list = result.get("ir", [])
ir_path = result.get("path", "")
# ir_generator produces a list; wrap to match rich format expectations
# for schema validation we accept both formats
return ir_list, ir_path
return result.get("ir", []), result.get("path", "")
return _run