Skip to content

Commit f4bec64

Browse files
committed
fix(test): read source as UTF-8 in the bare-Console AST sweep
The guard called path.read_text() with no encoding, so it used the locale codec. On Windows that is cp1252, which cannot decode the ⏱️ in timing.py:119, and the test died with UnicodeDecodeError before it could assert anything -- failing every windows-latest job in the matrix while passing on Linux and macOS. Reproduced locally by forcing the codec: read_text(encoding="cp1252") on timing.py raises at byte 3610; utf-8 reads it fine.
1 parent a0939dc commit f4bec64

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/deepctl-core/tests/unit/test_output_channels.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ def test_no_module_declares_a_bare_console(self) -> None:
7070
offenders: list[str] = []
7171

7272
for path in sorted(CORE_SRC.glob("*.py")):
73-
tree = ast.parse(path.read_text(), filename=str(path))
73+
# encoding is explicit because read_text() otherwise uses the
74+
# locale codec -- cp1252 on Windows, which cannot decode the
75+
# emoji in timing.py and fails the whole matrix.
76+
source = path.read_text(encoding="utf-8")
77+
tree = ast.parse(source, filename=str(path))
7478
for node in ast.walk(tree):
7579
if not isinstance(node, ast.Call):
7680
continue

0 commit comments

Comments
 (0)