test: skip network/live crawl by default; fix settings e2e key
- pytest_collection_modifyitems: skip @pytest.mark.network unless PROXYPOOL_RUN_NETWORK_TESTS=1 - Document opt-in in tests/README.md - e2e: replace removed crawl_timeout with validation_timeout Made-with: Cursor
This commit is contained in:
@@ -24,22 +24,24 @@ tests/
|
||||
|
||||
## 网络与真实调用
|
||||
|
||||
集成测试与 E2E **不再 mock** `PluginRunner` / `ValidatorService`:会发起真实 HTTP 爬取与代理验证(视设置而定)。运行全量 `pytest` 需要 **可用的出站网络**,且含 `network` / `slow` 标记的用例可能耗时数分钟。
|
||||
带 `@pytest.mark.network` 的用例会发起真实 HTTP 爬取,**默认不运行**(避免全量 `pytest` 卡住数十分种)。
|
||||
|
||||
跳过需外网的用例(例如离线快速检查):
|
||||
需要跑外网验收时(PowerShell 示例):
|
||||
|
||||
```powershell
|
||||
$env:PROXYPOOL_RUN_NETWORK_TESTS="1"; pytest tests/integration/test_plugins_live_crawl.py -v --tb=short
|
||||
```
|
||||
|
||||
离线快速检查直接:
|
||||
|
||||
```bash
|
||||
pytest -m "not network"
|
||||
pytest
|
||||
```
|
||||
|
||||
**插件爬取验收**(`test_plugins_live_crawl.py`):
|
||||
|
||||
- 核心 8 插件:必须至少 1 条代理且无 Runner 失败。
|
||||
- `fpw_*`:对照 [Free_Proxy_Website](https://github.com/cyubuchen/Free_Proxy_Website) 的公开源,允许 0 条(国际网络差异),使用更长超时。
|
||||
|
||||
```bash
|
||||
pytest tests/integration/test_plugins_live_crawl.py -v
|
||||
```
|
||||
- 核心 8 插件:必须至少 1 条代理且无 Runner 失败(依赖稳定外网)。
|
||||
- `fpw_*`:允许部分源 0 条;单插件可能接近各插件 `crawl_timeout_seconds` 上限。
|
||||
|
||||
## 运行测试
|
||||
|
||||
|
||||
Reference in New Issue
Block a user