test: isolate Jina timeout logging from missing-key warning (#5139)

This commit is contained in:
Daoyuan Li 2026-09-01 23:19:37 -07:00 committed by GitHub
parent fb722770e4
commit 3ac40bf9bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -242,6 +242,10 @@ Direct pytest collection or execution of `tests/test_client_live.py` remains
skipped unless `DEER_FLOW_RUN_LIVE_TESTS=1` is set. Do not add that opt-in to
default CI workflows.
Jina request-failure logging tests set a dummy API key so the separate once-per-process
missing-key warning cannot make assertions depend on test order or shard placement.
Missing-key behavior has its own tests in `tests/test_jina_client.py`.
### Running the Full Application
From the **project root** directory:

View File

@ -89,6 +89,9 @@ async def test_crawl_network_error(jina_client, monkeypatch):
async def test_crawl_transient_failure_logs_without_traceback(jina_client, monkeypatch, caplog):
"""Transient network failures must log at WARNING without a traceback and include the exception type."""
# Keep the missing-key warning independent of test order and shard placement.
monkeypatch.setenv("JINA_API_KEY", "test-key")
async def mock_post(self, url, **kwargs):
raise httpx.ConnectTimeout("timed out")