aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/run_tests.py
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2025-10-24 23:15:35 +0800
committer简律纯 <i@jyunko.cn>2025-10-24 23:15:35 +0800
commit08299b37dfda86e56e4f2b442f68ccd2da7a82e3 (patch)
treee155d11412a26f692d08b8eb796fa689fc5a4019 /tests/run_tests.py
parent990048eb2163127615de60d9359c150bdfb99536 (diff)
downloadconventional_role_play-08299b37dfda86e56e4f2b442f68ccd2da7a82e3.tar.gz
conventional_role_play-08299b37dfda86e56e4f2b442f68ccd2da7a82e3.zip
feat: Enhance Processor, RuleExtractor, and Renderers with type hints and improved documentation
- Added type hints to Processor methods for better clarity and type safety. - Improved documentation for Processor methods, including detailed descriptions of parameters and return types. - Refactored RuleExtractor to support optional configuration file loading and added error handling for file operations. - Enhanced MarkdownRenderer to handle both list and dictionary inputs, with improved rendering logic. - Created comprehensive examples and tests for all components, ensuring robust functionality and error handling. - Added example rules for D&D 5E and structured output files for various formats (JSON, HTML, Markdown). - Established a testing framework with clear instructions and coverage reporting.
Diffstat (limited to 'tests/run_tests.py')
-rw-r--r--tests/run_tests.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py
new file mode 100644
index 0000000..4cfc2d4
--- /dev/null
+++ b/tests/run_tests.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+"""
+测试套件运行器
+运行所有单元测试
+"""
+
+import sys
+import unittest
+from pathlib import Path
+
+# 添加 src 目录到路径
+src_path = Path(__file__).parent.parent / "src"
+sys.path.insert(0, str(src_path))
+
+
+def run_all_tests():
+ """运行所有测试"""
+ # 创建测试加载器
+ loader = unittest.TestLoader()
+
+ # 从当前目录加载所有测试
+ suite = loader.discover(
+ start_dir=Path(__file__).parent,
+ pattern='test_*.py'
+ )
+
+ # 运行测试
+ runner = unittest.TextTestRunner(verbosity=2)
+ result = runner.run(suite)
+
+ # 返回结果
+ return 0 if result.wasSuccessful() else 1
+
+
+if __name__ == "__main__":
+ sys.exit(run_all_tests())