summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2023-04-07 08:21:27 (GMT)
committerCraig Scott <craig.scott@crascit.com>2023-04-07 08:22:13 (GMT)
commitb855674f5de6adb4f4b34a87955ace957fa9bf90 (patch)
tree2ff158afb9ebc98da42b199fa11b28d5745cbe42 /Tests/RunCMake
parent0de00b8b69716c0d580f5e06a7eeeaf63b3b7036 (diff)
downloadCMake-b855674f5de6adb4f4b34a87955ace957fa9bf90.zip
CMake-b855674f5de6adb4f4b34a87955ace957fa9bf90.tar.gz
CMake-b855674f5de6adb4f4b34a87955ace957fa9bf90.tar.bz2
Tests: Always load presets schema as UTF-8
We know the encoding of the schema file, so we should specify it when we open it for reading. Previously, by not specifying it, the test was open to using an encoding based on the active locale when running the test. We may have been enforcing a "C" locale at a higher level, but we don't need to rely on that here, we can force correct behavior without that assumption. Issue: #24679
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py
index b2a67fc..836147a 100644
--- a/Tests/RunCMake/CMakePresets/validate_schema.py
+++ b/Tests/RunCMake/CMakePresets/validate_schema.py
@@ -4,13 +4,13 @@ import os.path
import sys
-with open(sys.argv[1], "rb") as f:
- contents = json.loads(f.read().decode("utf-8-sig"))
+with open(sys.argv[1], "r", encoding="utf-8-sig") as f:
+ contents = json.load(f)
schema_file = os.path.join(
os.path.dirname(__file__),
"..", "..", "..", "Help", "manual", "presets", "schema.json")
-with open(schema_file) as f:
+with open(schema_file, "r", encoding="utf-8") as f:
schema = json.load(f)
jsonschema.validate(contents, schema)