Skip to content

Fix tests for chardet 6.0 and pytest 9.1 - #3837

Open
yardenac wants to merge 3 commits into
encode:masterfrom
yardenac:fix-tests
Open

yardenac wants to merge 3 commits into
encode:masterfrom
yardenac:fix-tests

Conversation

@yardenac

Copy link
Copy Markdown

Summary

This fixes two testing bugs that were causing builds to crash on arch:

and one error that made a test redundant:

  • test_client_decode_text_using_explicit_encoding did not, in fact, use explicit encoding, but just repeated the same code from the autodetect test

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

issue encode#3772 reported a similar error fixed in pr encode#3773, but in a different test
i assume this was a mistake, as otherwise it's just testing the same thing as the previous test

@YashrajMiyatra YashrajMiyatra left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very clean test suite modernization.

  • Allowing both ISO-8859-1 and WINDOWS-1252 cleanly handles chardet 6.0's updated charset detection while remaining backwards-compatible.
  • Good catch on test_client_decode_text_using_explicit_encoding passing default_encoding="ISO-8859-1" instead of repeating autodetect.
  • Scoping caplog.record_tuples to records where record[0] == "httpx" prevents noisy cross-logger interference from pytest 9.1 when running alongside uvicorn test servers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants