Write snapshot file as utf-8

This commit is contained in:
Darren Burns
2022-09-21 11:45:16 +01:00
parent 1a658955da
commit 644922c829

View File

@@ -1,6 +1,4 @@
import difflib import difflib
import os
import sys
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime from datetime import datetime
from functools import partial from functools import partial
@@ -122,7 +120,7 @@ def pytest_sessionfinish(
num_snapshot_tests=num_snapshot_tests, num_snapshot_tests=num_snapshot_tests,
now=datetime.utcnow(), now=datetime.utcnow(),
) )
with open(snapshot_report_path, "w+") as snapshot_file: with open(snapshot_report_path, "w+", encoding="utf-8") as snapshot_file:
snapshot_file.write(rendered_report) snapshot_file.write(rendered_report)
session.config._textual_snapshots = diffs session.config._textual_snapshots = diffs