gh-91954: Use shell=True in test_subprocess.test_encoding_warning (GH-92090)

This commit is contained in:
Dennis Sweeney 2022-04-30 20:38:19 -04:00 committed by GitHub
parent 238aa6253b
commit b9636180b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1736,16 +1736,15 @@ class RunFuncTestCase(BaseTestCase):
def test_encoding_warning(self): def test_encoding_warning(self):
code = textwrap.dedent("""\ code = textwrap.dedent("""\
from subprocess import * from subprocess import *
args = ["echo", "hello"] run("echo hello", shell=True, text=True)
run(args, text=True) check_output("echo hello", shell=True, text=True)
check_output(args, text=True)
""") """)
cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code], cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
capture_output=True) capture_output=True)
lines = cp.stderr.splitlines() lines = cp.stderr.splitlines()
self.assertEqual(len(lines), 2) self.assertEqual(len(lines), 2, lines)
self.assertTrue(lines[0].startswith(b"<string>:3: EncodingWarning: ")) self.assertTrue(lines[0].startswith(b"<string>:2: EncodingWarning: "))
self.assertTrue(lines[1].startswith(b"<string>:4: EncodingWarning: ")) self.assertTrue(lines[1].startswith(b"<string>:3: EncodingWarning: "))
def _get_test_grp_name(): def _get_test_grp_name():