Skip to content

Commit 98bbd40

Browse files
committed
Encoding for subprocess.run
1 parent 284e39c commit 98bbd40

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/_pytest/pytester.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import contextlib
77
import gc
88
import importlib
9+
import locale
910
import os
1011
import platform
1112
import re
@@ -129,6 +130,7 @@ def get_open_files(self) -> List[Tuple[str, str]]:
129130
stderr=subprocess.DEVNULL,
130131
check=True,
131132
text=True,
133+
encoding=locale.getpreferredencoding(False),
132134
).stdout
133135

134136
def isopen(line: str) -> bool:

testing/test_parseopt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import locale
23
import os
34
import shlex
45
import subprocess
@@ -296,6 +297,7 @@ def test_argcomplete(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
296297
stderr=subprocess.DEVNULL,
297298
check=True,
298299
text=True,
300+
encoding=locale.getpreferredencoding(False),
299301
).stdout
300302
except (OSError, subprocess.CalledProcessError):
301303
pytest.skip("bash is not available")

0 commit comments

Comments
 (0)