Use utf-8 debug file

This commit is contained in:
Zac Hatfield-Dodds 2023-06-20 04:55:40 -07:00
parent 661b938fca
commit f6b995e9d5
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix writing non-encodable text to log file when using ``--debug``.

View File

@ -105,7 +105,7 @@ def pytest_cmdline_parse():
if config.option.debug:
# --debug | --debug <file.log> was provided.
path = config.option.debug
debugfile = open(path, "w")
debugfile = open(path, "w", encoding="utf-8")
debugfile.write(
"versions pytest-%s, "
"python-%s\ncwd=%s\nargs=%s\n\n"