feat: JSON 配置、质量分与仪表盘,及设置与爬取流程
- 后端改为 config/app.json;pytest 使用 config/app.test.json 与 set_config_file,不再依赖环境变量;移除 pydantic-settings。 - 前端 API/WebSocket 由 config/webui.json 经 Vite define 注入。 - 代理分数按延迟与随机取用次数计算,新增 use_count 与 proxy_scoring;保存设置时同步调度器启停。 - 仪表盘双饼图(可用/待验证协议);设置页去掉调度器启停按钮并移动立即验证;爬取全部结束后自动提交全量验证。 - 删除 script/settings_maintain.py(此前已标记删除)。 Made-with: Cursor
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
"""pytest 配置文件和 fixtures"""
|
||||
# 必须在任何 app.* 导入之前:下方 app fixture 会清空表,不可与生产共用 db/proxies.sqlite
|
||||
import os
|
||||
# 必须在任何会加载 app.core.config 的导入之前(测试库与生产库隔离)
|
||||
from pathlib import Path
|
||||
|
||||
os.environ["PROXYPOOL_DB_PATH"] = "db/proxies.test.sqlite"
|
||||
from app.core.config_paths import set_config_file
|
||||
|
||||
set_config_file(Path(__file__).resolve().parents[1] / "config" / "app.test.json")
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
@@ -14,8 +16,9 @@ import pytest
|
||||
|
||||
|
||||
def _network_tests_enabled() -> bool:
|
||||
v = os.environ.get("PROXYPOOL_RUN_NETWORK_TESTS", "").strip().lower()
|
||||
return v in ("1", "true", "yes", "on")
|
||||
from app.core.config import settings
|
||||
|
||||
return bool(getattr(settings, "run_network_tests", False))
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(config, items) -> None:
|
||||
@@ -24,8 +27,8 @@ def pytest_collection_modifyitems(config, items) -> None:
|
||||
return
|
||||
skip = pytest.mark.skip(
|
||||
reason=(
|
||||
"外网/真实爬取用例默认跳过。需要验收时设置环境变量 "
|
||||
"PROXYPOOL_RUN_NETWORK_TESTS=1 后再运行对应文件或 -m network。"
|
||||
"外网/真实爬取用例默认跳过。需要验收时在 config/app.test.json 中设置 "
|
||||
"\"run_network_tests\": true 后再运行对应文件或 -m network。"
|
||||
)
|
||||
)
|
||||
for item in items:
|
||||
|
||||
Reference in New Issue
Block a user