You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

31 lines
653 B

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
测试运行脚本
"""
import unittest
import sys
import os
def run_tests():
"""运行所有测试"""
# 添加src目录到Python路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
# 发现并运行测试
loader = unittest.TestLoader()
start_dir = 'tests'
suite = loader.discover(start_dir, pattern='test_*.py')
# 运行测试
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
return result.wasSuccessful()
if __name__ == '__main__':
success = run_tests()
sys.exit(0 if success else 1)