mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
gh-91954: Use shell=True in test_subprocess.test_encoding_warning (GH-92090)
This commit is contained in:
parent
238aa6253b
commit
b9636180b3
1 changed files with 5 additions and 6 deletions
|
|
@ -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():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue