From 3ac40bf9bd207462a821a74f0b42597fee100ec8 Mon Sep 17 00:00:00 2001 From: Daoyuan Li <94409450+DaoyuanLi2816@users.noreply.github.com> Date: Tue, 1 Sep 2026 23:19:37 -0700 Subject: [PATCH] test: isolate Jina timeout logging from missing-key warning (#5139) --- backend/AGENTS.md | 4 ++++ backend/tests/test_jina_client.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/backend/AGENTS.md b/backend/AGENTS.md index 345138ccd..03d335207 100644 --- a/backend/AGENTS.md +++ b/backend/AGENTS.md @@ -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: diff --git a/backend/tests/test_jina_client.py b/backend/tests/test_jina_client.py index b9845260c..8c4c30a71 100644 --- a/backend/tests/test_jina_client.py +++ b/backend/tests/test_jina_client.py @@ -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")