Files
ProxyPool/tests/support/plugins_for_runner.py
祀梦 0131c8b408 feat: fpw plugins, validation/crawl perf, WS stats, test DB isolation
- Add Free_Proxy_Website-style fpw_* plugins and register them
- Per-plugin crawl timeout (crawl_timeout_seconds=120); remove global crawl_timeout setting
- Validator: fix connect vs total timeout on save; SOCKS session LRU cache; drop redundant semaphore
- Validation handler uses single DB connection; batch upsert after crawl; WorkerPool put_nowait
- Remove unused max_retries from settings API/UI; settings maintenance SQL + init_db cleanup of deprecated keys
- WebSocket dashboard stats; ProxyList pool_filter and API alignment
- POST /api/proxies/delete-one for IPv6-safe deletes; task poll stops on 404
- pytest uses PROXYPOOL_DB_PATH=db/proxies.test.sqlite so tests do not wipe production DB
- .gitignore: explicit proxies.test.sqlite patterns; fix plugin_service ValidationException import

Made-with: Cursor
2026-04-05 13:39:19 +08:00

20 lines
622 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""供 PluginRunner 等测试使用的真实插件子类(非 unittest.mock"""
from typing import List
from app.core.plugin_system.base import BaseCrawlerPlugin
from app.models.domain import ProxyRaw
class UnhealthyPlugin(BaseCrawlerPlugin):
"""health_check 抛错,用于验证 Runner 对异常的统计与落库。"""
name = "test_unhealthy_runner"
display_name = "TestUnhealthy"
description = "PluginRunner health_check failure test double"
async def crawl(self) -> List[ProxyRaw]:
return []
async def health_check(self) -> bool:
raise RuntimeError("network down")