Skip to content

Commit 0dfd18a

Browse files
authored
Fix stderr bug in json.tool test (#346) (#676)
See #201 (comment) picked from commit b4e9087)
1 parent 78add33 commit 0dfd18a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/test/test_json/test_tool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import textwrap
44
import unittest
5-
import subprocess
5+
from subprocess import Popen, PIPE
66
from test import support
77
from test.support.script_helper import assert_python_ok
88

@@ -61,12 +61,11 @@ class TestTool(unittest.TestCase):
6161
""")
6262

6363
def test_stdin_stdout(self):
64-
with subprocess.Popen(
65-
(sys.executable, '-m', 'json.tool'),
66-
stdin=subprocess.PIPE, stdout=subprocess.PIPE) as proc:
64+
args = sys.executable, '-m', 'json.tool'
65+
with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc:
6766
out, err = proc.communicate(self.data.encode())
6867
self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
69-
self.assertEqual(err, None)
68+
self.assertEqual(err, b'')
7069

7170
def _create_infile(self):
7271
infile = support.TESTFN

0 commit comments

Comments
 (0)