Skip to content

Commit f037d52

Browse files
committed
gh-155491: Fix subprocess test_encoding_warning()
The test fails if run using PYTHONWARNINGS=error environment variable. Use make_clean_env() function to not inherit PYTHON environment variables.
1 parent e4b22ad commit f037d52

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_subprocess.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,9 @@ def test_encoding_warning(self):
20512051
run("echo hello", shell=True, text=True)
20522052
check_output("echo hello", shell=True, text=True)
20532053
""")
2054+
env = support.make_clean_env()
20542055
cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
2055-
capture_output=True)
2056+
capture_output=True, env=env)
20562057
lines = cp.stderr.splitlines()
20572058
self.assertEqual(len(lines), 2, lines)
20582059
self.assertStartsWith(lines[0], b"<string>:2: EncodingWarning: ")

0 commit comments

Comments
 (0)