Files
lookingWeb/tests/run_tests.py
T
cat-shark 01827224d6 fix: 修复主程序卡死与下载器集成,新增真实数据测试
- LookingWebMain: 强制 IPv4 避免 IPv6 不可达挂起;requests 加超时防卡死
- get_seed_from_element_detail: 修复限流页崩溃与 favicon 误作来源 URL,改用 canonical/传入 URL
- QbittorrentDownloader: 修复 main() 中模块/类误用导致的 download_by_seed AttributeError;请求加超时
- MySqlService: 修复数据库不可达时 query/execute/close 的 None 崩溃,close 后置空 connection
- 新增 cf_session: Cloudflare 人机认证 cookie 管理 + 限流退避重试 + 自动弹浏览器刷新验证
- 新增 refresh_cf_cookies.py: 弹出浏览器手动验证并保存 cf_clearance
- tests/: 真实网络/数据库测试(get_page、seed_is_exist、cf_session)+ run_tests.py runner
- 清理无用脚本(final_test2/verify_replace/REPLACEMENT_INFO),.idea 与 cookie 文件入 .gitignore

注: test_qbittorrent_downloader.py 11 个用例为既有失败(mock 目标 session 为实例属性,与实现错配),未在本次范围
2026-08-30 12:24:26 +08:00

34 lines
660 B
Python

#!/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())