feat(tools): Enforce utf-8 encoding with open() function

This commit is contained in:
Marek Fiala
2024-07-23 15:59:09 +02:00
committed by BOT
parent 305f1c1e5b
commit 2c814ef2fa
40 changed files with 115 additions and 124 deletions

View File

@@ -47,7 +47,7 @@ def test_semihost_vfs(dut: IdfDut) -> None:
dut.expect_exact('example: Wrote 2776 bytes')
dut.expect_exact('====================== HOST DATA START =========================')
with open(HOST_FILE_PATH) as f:
with open(HOST_FILE_PATH, encoding='utf-8') as f:
for line in f:
if line.strip():
dut.expect_exact(line.strip())
@@ -55,7 +55,7 @@ def test_semihost_vfs(dut: IdfDut) -> None:
dut.expect_exact('====================== HOST DATA END =========================')
dut.expect_exact('example: Read 6121 bytes')
with open(os.path.join(TEMP_DIR, 'esp32_stdout.txt')) as f:
with open(os.path.join(TEMP_DIR, 'esp32_stdout.txt'), encoding='utf-8') as f:
def expected_content() -> t.Iterator[str]:
yield 'example: Switched to semihosted stdout'