From da5287753d7b444556741e494c248e82cc2f6f79 Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sun, 5 Jul 2026 19:55:32 +0530 Subject: [PATCH] test(config): assert aiohttp User-Agent test actually verifies the request test_agent_is_used_aiohttp exercised the aiohttp User-Agent override (set_http_lib_agents) but discarded the response and had no assertion, so it verified nothing. A regression in the aiohttp branch of set_http_lib_agents would still pass this test. Its requests and httpx siblings both assert status_code == 200. Return the response status from the coroutine and assert it equals 200, mirroring the siblings, so a broken aiohttp User-Agent makes the request unserved and fails the test. Co-authored-by: Claude Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> --- tests/test_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index bf712623b..1f2f8fab6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -809,12 +809,14 @@ def test_agent_is_used_aiohttp(httpserver: HTTPServer): async def main(): async with aiohttp.ClientSession() as session: async with session.get(httpserver.url_for("/")) as response: - html = await response.text() + return response.status httpserver.expect_request( "/", headers={"User-Agent": AGENT_TEST} ).respond_with_data("") - asyncio.run(main()) + assert ( + asyncio.run(main()) == 200 + ), "aiohttp User-Agent should match the expected header so the request is served" def test_api_key_in_config():