Skip to content

Commit ed14ed7

Browse files
fix!(snapshottest): Use UTF8 encoding
1 parent 41dd6e4 commit ed14ed7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/snapshottest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def _safe_cls_name(o: type):
3737

3838
def _open_or_create_rw(path: str):
3939
try:
40-
return open(path, 'r+')
40+
return open(path, 'r+', encoding='utf8')
4141
except FileNotFoundError:
42-
return open(path, 'w+') # Try to create if not exists
42+
return open(path, 'w+', encoding='utf8') # Try to create if not exists
4343

4444

4545
_SNAPS_NOT_FOUND_MSG = (
@@ -122,7 +122,7 @@ def setUp(self) -> None:
122122
@classmethod
123123
def _read_snapshot_text(cls):
124124
try:
125-
with open(cls.snap_file) as f:
125+
with open(cls.snap_file, encoding='utf8') as f:
126126
return f.read()
127127
except FileNotFoundError as orig_err:
128128
raise SnapshotsNotFound("Snapshot file not found") from orig_err

0 commit comments

Comments
 (0)