Skip to content

Commit dbde113

Browse files
authored
Use io module to encode as UTF-8
This allows variables files to contain non-ASCII characters without throwing an error.
1 parent 43db70e commit dbde113

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pytest_variables/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os.path
66
import sys
77
import warnings
8+
import io
89

910
import pytest
1011
from functools import reduce
@@ -14,7 +15,7 @@
1415

1516
def default(module, path):
1617
try:
17-
with open(path, 'rb') as f:
18+
with io.open(path, 'r', encoding='utf8') as f:
1819
return module.load(f)
1920
except TypeError:
2021
# NOTE: python 3.2-3.5 json expects string,

0 commit comments

Comments
 (0)