Skip to content

Commit 4ee3c23

Browse files
[3.14] gh-155491: Fix subprocess test_encoding_warning() (GH-155492) (#155507)
gh-155491: Fix subprocess test_encoding_warning() (GH-155492) The test fails if run using PYTHONWARNINGS=error environment variable. Use make_clean_env() function to not inherit PYTHON environment variables. (cherry picked from commit 433c842) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 142b007 commit 4ee3c23

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
@@ -2016,8 +2016,9 @@ def test_encoding_warning(self):
20162016
run("echo hello", shell=True, text=True)
20172017
check_output("echo hello", shell=True, text=True)
20182018
""")
2019+
env = support.make_clean_env()
20192020
cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
2020-
capture_output=True)
2021+
capture_output=True, env=env)
20212022
lines = cp.stderr.splitlines()
20222023
self.assertEqual(len(lines), 2, lines)
20232024
self.assertStartsWith(lines[0], b"<string>:2: EncodingWarning: ")

0 commit comments

Comments
 (0)