Skip to content

Commit f6b995e

Browse files
committed
Use utf-8 debug file
1 parent 661b938 commit f6b995e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog/7781.bugfix.rst

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

src/_pytest/helpconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def pytest_cmdline_parse():
105105
if config.option.debug:
106106
# --debug | --debug <file.log> was provided.
107107
path = config.option.debug
108-
debugfile = open(path, "w")
108+
debugfile = open(path, "w", encoding="utf-8")
109109
debugfile.write(
110110
"versions pytest-%s, "
111111
"python-%s\ncwd=%s\nargs=%s\n\n"

0 commit comments

Comments
 (0)