Kaydet (Commit) b4e9087e authored tarafından Daniel Himmelstein's avatar Daniel Himmelstein Kaydeden (comit) Berker Peksag

Fix stderr bug in json.tool test (#346)

See https://github.com/python/cpython/pull/201#discussion_r103229425.
üst 6c3d5274
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
import sys import sys
import textwrap import textwrap
import unittest import unittest
import subprocess from subprocess import Popen, PIPE
from test import support from test import support
from test.support.script_helper import assert_python_ok from test.support.script_helper import assert_python_ok
...@@ -61,12 +61,11 @@ class TestTool(unittest.TestCase): ...@@ -61,12 +61,11 @@ class TestTool(unittest.TestCase):
""") """)
def test_stdin_stdout(self): def test_stdin_stdout(self):
with subprocess.Popen( args = sys.executable, '-m', 'json.tool'
(sys.executable, '-m', 'json.tool'), with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc:
stdin=subprocess.PIPE, stdout=subprocess.PIPE) as proc:
out, err = proc.communicate(self.data.encode()) out, err = proc.communicate(self.data.encode())
self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
self.assertEqual(err, None) self.assertEqual(err, b'')
def _create_infile(self): def _create_infile(self):
infile = support.TESTFN infile = support.TESTFN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment