From 0788a13c8a354174adcd1acc1e76d59304356720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=80=E6=A2=A6?= <3501646051@qq.com> Date: Sat, 4 Apr 2026 19:27:49 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _test_batch.py | 18 ------------------ _test_crawlers.py | 47 ----------------------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 _test_batch.py delete mode 100644 _test_crawlers.py diff --git a/_test_batch.py b/_test_batch.py deleted file mode 100644 index a4b2ac8..0000000 --- a/_test_batch.py +++ /dev/null @@ -1,18 +0,0 @@ -import asyncio -import time -import app.plugins -from app.services.plugin_service import PluginService - -async def main(): - svc = PluginService() - start = time.time() - results = await svc.run_all_plugins() - elapsed = time.time() - start - print(f"Batch crawl completed in {elapsed:.2f}s") - print(f"Total unique proxies: {len(results)}") - from collections import Counter - c = Counter(p.protocol for p in results) - for proto, cnt in sorted(c.items()): - print(f" {proto}: {cnt}") - -asyncio.run(main()) diff --git a/_test_crawlers.py b/_test_crawlers.py deleted file mode 100644 index 3da9a47..0000000 --- a/_test_crawlers.py +++ /dev/null @@ -1,47 +0,0 @@ -import asyncio -import app.plugins -from app.core.plugin_system.registry import registry -from app.core.log import logger -import logging -logger.setLevel(logging.WARNING) - -async def test_plugin(p, timeout=20): - try: - proxies = await asyncio.wait_for(p.crawl(), timeout=timeout) - return len(proxies), proxies[:1] if proxies else [] - except asyncio.TimeoutError: - return -2, [] - except Exception as e: - return -1, [str(e)] - -async def test_all(): - plugins = registry.list_plugins() - print(f'Total plugins: {len(plugins)}') - results = {} - for p in plugins: - print(f'Testing {p.name} (timeout=20s)...', flush=True) - count, sample = await test_plugin(p, timeout=20) - results[p.name] = count - if count > 0: - print(f' -> OK: {count} proxies, sample={sample[0]}') - elif count == 0: - print(f' -> EMPTY') - elif count == -2: - print(f' -> TIMEOUT') - else: - print(f' -> ERROR: {sample[0]}') - - print('\n' + '='*50) - print('SUMMARY:') - for name, count in sorted(results.items()): - if count > 0: - status = 'OK' - elif count == 0: - status = 'EMPTY' - elif count == -2: - status = 'TIMEOUT' - else: - status = 'ERROR' - print(f' {name:22s} {status:8s} ({count} proxies)') - -asyncio.run(test_all())