SquishTests: Fix writing test files on Windows

Writing the text test files without encoding can end up in
ANSI encoding of the files and in turn a fail when opening
as the file is treated read only until correct encoding is
used.

Change-Id: I9e21e240b3b02011a2266dfda1f1b453c3dad457
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2023-09-19 10:26:28 +02:00
parent 6cc11b21c5
commit 383cfb77cc

View File

@@ -89,7 +89,7 @@ def prepareFileExternal(fileName, content):
test.log("Added trailing whitespace.")
modifiedContent += currentLine
with open(fileName, "w") as f:
with open(fileName, "w", encoding="utf-8") as f: # used only with text files, so okay
f.write(modifiedContent)
if not emptyLine or not trailingWS: