#!/usr/bin/env python3 """ 运行 tests/ 目录下全部测试 运行命令: uv run python tests/run_tests.py """ import pytest import sys import os def main(): """运行测试""" # 本脚本位于 tests/ 目录,直接运行该目录下所有测试 script_dir = os.path.dirname(os.path.abspath(__file__)) tests_dir = script_dir os.chdir(script_dir) # 配置 pytest exit_code = pytest.main([ str(tests_dir), "-v", "--tb=short", "--log-cli-level=INFO", "-W", "ignore::DeprecationWarning" ]) return exit_code if __name__ == "__main__": sys.exit(main())