@@ -79,7 +79,7 @@ def test_process_preexec_fn_1(self):
79
79
async def test ():
80
80
cmd = sys .executable
81
81
proc = await asyncio .create_subprocess_exec (
82
- cmd , '-c' ,
82
+ cmd , b'-W' , b'ignore' , '-c' ,
83
83
'import os,sys;sys.stdout.write(os.getenv("FRUIT"))' ,
84
84
stdout = subprocess .PIPE ,
85
85
preexec_fn = lambda : os .putenv ("FRUIT" , "apple" ),
@@ -100,7 +100,7 @@ def raise_it():
100
100
async def test ():
101
101
cmd = sys .executable
102
102
proc = await asyncio .create_subprocess_exec (
103
- cmd , '-c' , 'import time; time.sleep(10)' ,
103
+ cmd , b'-W' , b'ignore' , '-c' , 'import time; time.sleep(10)' ,
104
104
preexec_fn = raise_it ,
105
105
loop = self .loop )
106
106
@@ -126,7 +126,7 @@ async def test():
126
126
def test_process_executable_1 (self ):
127
127
async def test ():
128
128
proc = await asyncio .create_subprocess_exec (
129
- b'doesnotexist' , b'-c' , b'print("spam")' ,
129
+ b'doesnotexist' , b'-W' , b'ignore' , b'- c' , b'print("spam")' ,
130
130
executable = sys .executable ,
131
131
stdout = subprocess .PIPE ,
132
132
loop = self .loop )
@@ -145,7 +145,7 @@ async def test():
145
145
146
146
cmd = sys .executable
147
147
proc = await asyncio .create_subprocess_exec (
148
- cmd , b'-c' , prog ,
148
+ cmd , b'-W' , b'ignore' , b'- c' , prog ,
149
149
stdin = subprocess .PIPE ,
150
150
stdout = subprocess .PIPE ,
151
151
loop = self .loop )
@@ -177,7 +177,7 @@ def handler(signum, frame):
177
177
178
178
cmd = sys .executable
179
179
proc = await asyncio .create_subprocess_exec (
180
- cmd , b'-c' , prog ,
180
+ cmd , b'-W' , b'ignore' , b'- c' , prog ,
181
181
stdin = subprocess .PIPE ,
182
182
stdout = subprocess .PIPE ,
183
183
stderr = subprocess .PIPE ,
@@ -216,7 +216,7 @@ async def test():
216
216
217
217
cmd = sys .executable
218
218
proc = await asyncio .create_subprocess_exec (
219
- cmd , b'-c' , prog ,
219
+ cmd , b'-W' , b'ignore' , b'- c' , prog ,
220
220
stdin = subprocess .PIPE ,
221
221
stdout = subprocess .PIPE ,
222
222
stderr = subprocess .PIPE ,
@@ -260,7 +260,7 @@ async def test():
260
260
'''
261
261
262
262
proc = await asyncio .create_subprocess_exec (
263
- sys .executable , '-c' , prog ,
263
+ sys .executable , b'-W' , b'ignore' , b '-c' , prog ,
264
264
stdout = subprocess .PIPE ,
265
265
stderr = subprocess .STDOUT ,
266
266
loop = self .loop )
@@ -280,7 +280,7 @@ async def test():
280
280
'''
281
281
282
282
proc = await asyncio .create_subprocess_exec (
283
- sys .executable , '-c' , prog ,
283
+ sys .executable , b'-W' , b'ignore' , b '-c' , prog ,
284
284
stdin = subprocess .DEVNULL ,
285
285
stdout = subprocess .DEVNULL ,
286
286
stderr = subprocess .DEVNULL ,
@@ -316,7 +316,7 @@ async def test():
316
316
tempfile .TemporaryFile () as non_inherited :
317
317
318
318
proc = await asyncio .create_subprocess_exec (
319
- sys .executable , '-c' , prog , '--' ,
319
+ sys .executable , b'-W' , b'ignore' , b '-c' , prog , '--' ,
320
320
str (inherited .fileno ()),
321
321
str (non_inherited .fileno ()),
322
322
stdout = subprocess .PIPE ,
@@ -334,17 +334,18 @@ async def test():
334
334
class _AsyncioTests :
335
335
336
336
# Program blocking
337
- PROGRAM_BLOCKED = [sys .executable , '-c' , 'import time; time.sleep(3600)' ]
337
+ PROGRAM_BLOCKED = [sys .executable , b'-W' , b'ignore' ,
338
+ b'-c' , b'import time; time.sleep(3600)' ]
338
339
339
340
# Program copying input to output
340
341
PROGRAM_CAT = [
341
- sys .executable , '-c' ,
342
- ';' .join (('import sys' ,
343
- 'data = sys.stdin.buffer.read()' ,
344
- 'sys.stdout.buffer.write(data)' ))]
342
+ sys .executable , b '-c' ,
343
+ b ';' .join ((b 'import sys' ,
344
+ b 'data = sys.stdin.buffer.read()' ,
345
+ b 'sys.stdout.buffer.write(data)' ))]
345
346
346
347
PROGRAM_ERROR = [
347
- sys .executable , '- c' , '1/0'
348
+ sys .executable , b'-W' , b'ignore' , b'- c' , b '1/0'
348
349
]
349
350
350
351
def test_stdin_not_inheritable (self ):
@@ -354,7 +355,7 @@ def test_stdin_not_inheritable(self):
354
355
def len_message (message ):
355
356
code = 'import sys; data = sys.stdin.read(); print(len(data))'
356
357
proc = yield from asyncio .create_subprocess_exec (
357
- sys .executable , '-c' , code ,
358
+ sys .executable , b'-W' , b'ignore' , b '-c' , code ,
358
359
stdin = asyncio .subprocess .PIPE ,
359
360
stdout = asyncio .subprocess .PIPE ,
360
361
stderr = asyncio .subprocess .PIPE ,
@@ -499,7 +500,7 @@ def test_terminate(self):
499
500
500
501
def test_send_signal (self ):
501
502
code = 'import time; print("sleeping", flush=True); time.sleep(3600)'
502
- args = [sys .executable , '-c' , code ]
503
+ args = [sys .executable , b'-W' , b'ignore' , b '-c' , code ]
503
504
create = asyncio .create_subprocess_exec (* args ,
504
505
stdout = subprocess .PIPE ,
505
506
loop = self .loop )
@@ -629,7 +630,7 @@ async def test():
629
630
'''
630
631
631
632
proc = await asyncio .create_subprocess_exec (
632
- sys .executable , '-c' , prog ,
633
+ sys .executable , b'-W' , b'ignore' , b '-c' , prog ,
633
634
loop = self .loop )
634
635
635
636
out , err = await proc .communicate ()
0 commit comments