mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-07 10:08:50 -05:00
[PR #1596] [MERGED] fix(labs/tests): open lab files with explicit UTF-8 encoding #9208
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1596
Author: @Shashank-Tripathi-07
Created: 4/28/2026
Status: ✅ Merged
Merged: 4/28/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/test-static-utf8-encoding📝 Commits (1)
e42cf0dfix(labs/tests): open lab files with explicit UTF-8 encoding📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
labs/tests/test_static.py(+1 -1)📄 Description
Summary
read_source()intest_static.pyusedopen()without specifying an encodingcp1252, which cannot decode UTF-8 byte sequences like0x90(used in em-dash and similar characters present in lab markdown strings)TestWidgetReturnCompletenesstests failed on Windows withUnicodeDecodeError; passingPYTHONUTF8=1made them all greenencoding="utf-8"to the singleopen()call inread_source()Root cause
Test plan
pytest labs/tests/test_static.py -qpasses (755 passed, 4 skipped, 1 xfailed) on both Linux and Windows withoutPYTHONUTF8=1🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.