Skip to content

Commit b963618

Browse files
authored
gh-91954: Use shell=True in test_subprocess.test_encoding_warning (GH-92090)
1 parent 238aa62 commit b963618

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Lib/test/test_subprocess.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,16 +1736,15 @@ def test_run_with_shell_timeout_and_capture_output(self):
17361736
def test_encoding_warning(self):
17371737
code = textwrap.dedent("""\
17381738
from subprocess import *
1739-
args = ["echo", "hello"]
1740-
run(args, text=True)
1741-
check_output(args, text=True)
1739+
run("echo hello", shell=True, text=True)
1740+
check_output("echo hello", shell=True, text=True)
17421741
""")
17431742
cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
17441743
capture_output=True)
17451744
lines = cp.stderr.splitlines()
1746-
self.assertEqual(len(lines), 2)
1747-
self.assertTrue(lines[0].startswith(b"<string>:3: EncodingWarning: "))
1748-
self.assertTrue(lines[1].startswith(b"<string>:4: EncodingWarning: "))
1745+
self.assertEqual(len(lines), 2, lines)
1746+
self.assertTrue(lines[0].startswith(b"<string>:2: EncodingWarning: "))
1747+
self.assertTrue(lines[1].startswith(b"<string>:3: EncodingWarning: "))
17491748

17501749

17511750
def _get_test_grp_name():

0 commit comments

Comments
 (0)