From ab5754ca99f7d82e0096b6e17b8999e878f5e767 Mon Sep 17 00:00:00 2001 From: yar cohen Date: Mon, 16 Nov 2026 12:50:30 -0800 Subject: [PATCH 1/3] Adapt test_client_decode_text_using_autodetect for chardet 6.0 issue #3772 reported a similar error fixed in pr #3773, but in a different test --- tests/client/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index 657839018a..172908e81d 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -431,7 +431,7 @@ def cp1252_but_no_content_type(request): assert response.status_code == 200 assert response.reason_phrase == "OK" - assert response.encoding == "ISO-8859-1" + assert response.encoding in ("ISO-8859-1", "WINDOWS-1252") assert response.text == text From 5db2e4b70973fb54a8d13a1be3d77055ca0ec199 Mon Sep 17 00:00:00 2001 From: yar cohen Date: Mon, 16 Nov 2026 13:09:50 -0800 Subject: [PATCH 2/3] using_explicit_encoding should use explicit encoding i assume this was a mistake, as otherwise it's just testing the same thing as the previous test --- tests/client/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index 172908e81d..fc2b378a25 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -453,7 +453,7 @@ def cp1252_but_no_content_type(request): return httpx.Response(200, content=content) transport = httpx.MockTransport(cp1252_but_no_content_type) - with httpx.Client(transport=transport, default_encoding=autodetect) as client: + with httpx.Client(transport=transport, default_encoding="ISO-8859-1") as client: response = client.get("http://www.example.com") assert response.status_code == 200 From 440dd004c98d8717c397645f8270dd3d1fc08976 Mon Sep 17 00:00:00 2001 From: yar cohen Date: Mon, 16 Nov 2026 13:31:48 -0800 Subject: [PATCH 3/3] pytest 9.1+ caplog includes uvicorn records, so filter them out --- tests/test_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index f9c215f65a..65659ab31c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -56,7 +56,7 @@ def test_logging_request(server, caplog): response = client.get(server.url) assert response.status_code == 200 - assert caplog.record_tuples == [ + assert [record for record in caplog.record_tuples if record[0] == "httpx"] == [ ( "httpx", logging.INFO, @@ -71,7 +71,7 @@ def test_logging_redirect_chain(server, caplog): response = client.get(server.url.copy_with(path="/redirect_301")) assert response.status_code == 200 - assert caplog.record_tuples == [ + assert [record for record in caplog.record_tuples if record[0] == "httpx"] == [ ( "httpx", logging.INFO,