@@ -107,9 +107,9 @@ def test_basic(self, tmpdir):
107
107
'arg5 a\\ \\ b' ,
108
108
]
109
109
proc = subprocess .Popen (
110
- cmd , stdout = subprocess .PIPE , stdin = subprocess .PIPE )
111
- stdout , stderr = proc .communicate ('hello\n world\n ' . encode ( 'ascii' ) )
112
- actual = stdout .decode ( 'ascii' ). replace ('\r \n ' , '\n ' )
110
+ cmd , stdout = subprocess .PIPE , stdin = subprocess .PIPE , text = True )
111
+ stdout , stderr = proc .communicate ('hello\n world\n ' )
112
+ actual = stdout .replace ('\r \n ' , '\n ' )
113
113
expected = textwrap .dedent (r"""
114
114
\foo-script.py
115
115
['arg1', 'arg 2', 'arg "2\\"', 'arg 4\\', 'arg5 a\\\\b']
@@ -148,9 +148,11 @@ def test_with_options(self, tmpdir):
148
148
cmd ,
149
149
stdout = subprocess .PIPE ,
150
150
stdin = subprocess .PIPE ,
151
- stderr = subprocess .STDOUT )
151
+ stderr = subprocess .STDOUT ,
152
+ text = True ,
153
+ )
152
154
stdout , stderr = proc .communicate ()
153
- actual = stdout .decode ( 'ascii' ). replace ('\r \n ' , '\n ' )
155
+ actual = stdout .replace ('\r \n ' , '\n ' )
154
156
expected = textwrap .dedent (r"""
155
157
\foo-script.py
156
158
[]
@@ -188,7 +190,7 @@ def test_basic(self, tmpdir):
188
190
]
189
191
proc = subprocess .Popen (
190
192
cmd , stdout = subprocess .PIPE , stdin = subprocess .PIPE ,
191
- stderr = subprocess .STDOUT )
193
+ stderr = subprocess .STDOUT , text = True )
192
194
stdout , stderr = proc .communicate ()
193
195
assert not stdout
194
196
assert not stderr
0 commit comments