88from tools .ci .check_governance_gate import (
99 find_forbidden_matches ,
1010 load_forbidden_patterns ,
11- validate_priority_score ,
11+ validate_pr_body ,
1212)
1313
1414
@@ -29,22 +29,49 @@ def test_find_forbidden_matches(changed_paths, patterns, expected):
2929 assert find_forbidden_matches (changed_paths , normalized ) == expected
3030
3131
32- @pytest .mark .parametrize (
33- "body" ,
34- [
35- "Priority Score: 5 / 安全性強化" ,
36- "Priority Score: 1 / 即応性向上" ,
37- "Priority Score: 3" ,
38- "Priority Score: / 理由" ,
39- "Priority Score: abc / 理由" ,
40- "Priority Score: <!-- 例: 5 / prioritization.yaml#phase1 -->" ,
41- "priority score: 3" ,
42- "" ,
43- None ,
44- ],
45- )
46- def test_validate_priority_score_is_now_noop (body ):
47- assert validate_priority_score (body ) is True
32+ def test_validate_pr_body_success (capsys ):
33+ body = """
34+ Intent: INT-123
35+ ## EVALUATION
36+ Priority Score: 4.5 / 安全性強化
37+ """
38+
39+ assert validate_pr_body (body ) is True
40+ captured = capsys .readouterr ()
41+ assert captured .err == ""
42+
43+
44+ def test_validate_pr_body_missing_intent (capsys ):
45+ body = """
46+ ## EVALUATION
47+ Priority Score: 2
48+ """
49+
50+ assert validate_pr_body (body ) is False
51+ captured = capsys .readouterr ()
52+ assert "PR body must include 'Intent: INT-xxx'" in captured .err
53+
54+
55+ def test_validate_pr_body_missing_evaluation (capsys ):
56+ body = """
57+ Intent: INT-001
58+ Priority Score: 3
59+ """
60+
61+ assert validate_pr_body (body ) is False
62+ captured = capsys .readouterr ()
63+ assert "PR must reference EVALUATION" in captured .err
64+
65+
66+ def test_validate_pr_body_warns_without_priority_score (capsys ):
67+ body = """
68+ Intent: INT-789
69+ ## EVALUATION
70+ """
71+
72+ assert validate_pr_body (body ) is True
73+ captured = capsys .readouterr ()
74+ assert "Consider adding 'Priority Score: <number>'" in captured .err
4875
4976
5077def test_load_forbidden_patterns (tmp_path ):
0 commit comments