Skip to content

Commit

Permalink
Use utf-8 debug file
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jun 20, 2023
1 parent 661b938 commit f6b995e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/7781.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix writing non-encodable text to log file when using ``--debug``.
2 changes: 1 addition & 1 deletion src/_pytest/helpconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f6b995e

Please sign in to comment.