Skip to content

Commit cdb9327

Browse files
committed
Fix file encoding for Windows
1 parent 989af50 commit cdb9327

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/test_compliance.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,20 @@ def _walk_files():
4848

4949

5050
def load_cases(full_path):
51-
all_test_data = json.load(open(full_path), object_pairs_hook=OrderedDict)
52-
for test_data in all_test_data:
53-
given = test_data['given']
54-
for case in test_data['cases']:
55-
if 'result' in case:
56-
test_type = 'result'
57-
elif 'error' in case:
58-
test_type = 'error'
59-
elif 'bench' in case:
60-
test_type = 'bench'
61-
else:
62-
raise RuntimeError("Unknown test type: %s" % json.dumps(case))
63-
yield (given, test_type, case)
51+
with open(full_path, 'r', encoding='utf-8') as f:
52+
all_test_data = json.load(f, object_pairs_hook=OrderedDict)
53+
for test_data in all_test_data:
54+
given = test_data['given']
55+
for case in test_data['cases']:
56+
if 'result' in case:
57+
test_type = 'result'
58+
elif 'error' in case:
59+
test_type = 'error'
60+
elif 'bench' in case:
61+
test_type = 'bench'
62+
else:
63+
raise RuntimeError(f"Unknown test type: {json.dumps(case)}")
64+
yield (given, test_type, case)
6465

6566

6667
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)