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
@@ -147,6 +147,32 @@ def run_all_tests():
return total_failures == 0
# ═══════════════════════════════════════════════════════════════════════════════
# pytest discovery support
# ═══════════════════════════════════════════════════════════════════════════════
import pytest # noqa: E402
def test_step2_5_path_enumeration():
"""pytest: path_enumeration.json should have valid structure."""
try:
path_data = config.load_json(config.PATH_ENUM_JSON)
except FileNotFoundError:
pytest.skip("path_enumeration.json not found — run step2_5_branch_coverage.py first")
errors = check_path_enumeration(path_data)
assert not errors, f"path enumeration errors: {errors}"
def test_step2_5_autocomplete_fragments():
"""pytest: auto-complete fragments must have valid structure if present."""
fragments = load_autocomplete_fragments()
errors = check_autocomplete_fragments(fragments)
# If fragments is None (no autocomplete needed), check_autocomplete_fragments returns a warning
actual_errors = [e for e in errors if "未生成" not in e]
assert not actual_errors, f"autocomplete fragment errors: {actual_errors}"
if __name__ == "__main__":
success = run_all_tests()
sys.exit(0 if success else 1)