diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-03-16 13:22:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 13:22:35 (GMT) |
commit | 0dfd18a1e14e08b0d6459c2dd1898e5bb38020c5 (patch) | |
tree | d13e647860d86c282bdbf21321df2a125f685abb /Lib/test | |
parent | 78add3309b53d68c2c5c118ec63f7485bbf93c9a (diff) | |
download | cpython-0dfd18a1e14e08b0d6459c2dd1898e5bb38020c5.zip cpython-0dfd18a1e14e08b0d6459c2dd1898e5bb38020c5.tar.gz cpython-0dfd18a1e14e08b0d6459c2dd1898e5bb38020c5.tar.bz2 |
Fix stderr bug in json.tool test (#346) (#676)
See https://github.com/python/cpython/pull/201#discussion_r103229425.(cherry picked from commit b4e9087e7b77e8f76feac76f9c1ab21b49c0c766)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_json/test_tool.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/test_json/test_tool.py b/Lib/test/test_json/test_tool.py index 15f3736..9d93f93 100644 --- a/Lib/test/test_json/test_tool.py +++ b/Lib/test/test_json/test_tool.py @@ -2,7 +2,7 @@ import os import sys import textwrap import unittest -import subprocess +from subprocess import Popen, PIPE from test import support from test.support.script_helper import assert_python_ok @@ -61,12 +61,11 @@ class TestTool(unittest.TestCase): """) def test_stdin_stdout(self): - with subprocess.Popen( - (sys.executable, '-m', 'json.tool'), - stdin=subprocess.PIPE, stdout=subprocess.PIPE) as proc: + args = sys.executable, '-m', 'json.tool' + with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc: out, err = proc.communicate(self.data.encode()) self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, None) + self.assertEqual(err, b'') def _create_infile(self): infile = support.TESTFN |