Skip to content

Commit 178aaa2

Browse files
[3.13] gh-155491: Fix subprocess test_encoding_warning() (GH-155492) (#155508)
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 cada590 commit 178aaa2

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

0 commit comments

Comments
 (0)