]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91954: Use shell=True in test_subprocess.test_encoding_warning (GH-92090)
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Sun, 1 May 2022 00:38:19 +0000 (20:38 -0400)
committerGitHub <noreply@github.com>
Sun, 1 May 2022 00:38:19 +0000 (20:38 -0400)
Lib/test/test_subprocess.py

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