fix(#201): convert helper test_* functions to check_*, add pytest-compatible tests

This commit is contained in:
2026-04-17 05:09:55 +00:00
parent fe8a70adc1
commit 537bb1b61b

View File

@@ -8,7 +8,7 @@ import json
import re
from pathlib import Path
def test_prompt_structure():
def check_prompt_structure():
"""Test that the prompt has the required structure."""
prompt_path = Path("templates/harvest-prompt.md")
if not prompt_path.exists():
@@ -52,7 +52,7 @@ def test_prompt_structure():
return True, "Prompt structure is valid"
def test_confidence_scoring():
def check_confidence_scoring():
"""Test that confidence scoring is properly defined."""
prompt_path = Path("templates/harvest-prompt.md")
content = prompt_path.read_text()
@@ -74,7 +74,7 @@ def test_confidence_scoring():
return True, "Confidence scoring is properly defined"
def test_example_quality():
def check_example_quality():
"""Test that examples are clear and complete."""
prompt_path = Path("templates/harvest-prompt.md")
content = prompt_path.read_text()
@@ -100,7 +100,7 @@ def test_example_quality():
return True, "Examples are clear and complete"
def test_constraint_coverage():
def check_constraint_coverage():
"""Test that constraints cover all requirements."""
prompt_path = Path("templates/harvest-prompt.md")
content = prompt_path.read_text()
@@ -120,7 +120,7 @@ def test_constraint_coverage():
return True, "Constraints cover all requirements"
def test_test_sessions():
def check_test_sessions():
"""Test that test sessions exist and are valid."""
test_sessions_dir = Path("test_sessions")
if not test_sessions_dir.exists():
@@ -147,11 +147,11 @@ def test_test_sessions():
def run_all_tests():
"""Run all tests and return results."""
tests = [
("Prompt Structure", test_prompt_structure),
("Confidence Scoring", test_confidence_scoring),
("Example Quality", test_example_quality),
("Constraint Coverage", test_constraint_coverage),
("Test Sessions", test_test_sessions)
("Prompt Structure", check_prompt_structure),
("Confidence Scoring", check_confidence_scoring),
("Example Quality", check_example_quality),
("Constraint Coverage", check_constraint_coverage),
("Test Sessions", check_test_sessions)
]
results = []
@@ -195,6 +195,30 @@ def run_all_tests():
return all_passed, results
# --- Pytest-compatible tests ---
def test_prompt_structure():
passed, msg = check_prompt_structure()
assert passed, msg
def test_confidence_scoring():
passed, msg = check_confidence_scoring()
assert passed, msg
def test_example_quality():
passed, msg = check_example_quality()
assert passed, msg
def test_constraint_coverage():
passed, msg = check_constraint_coverage()
assert passed, msg
def test_test_sessions():
passed, msg = check_test_sessions()
assert passed, msg
if __name__ == "__main__":
all_passed, results = run_all_tests()