@@ -168,7 +168,8 @@ def test_Popen_mock(
168
168
attrs = {"communicate.return_value" : ("output" , "error" ), "returncode" : 1 }
169
169
process_mock .configure_mock (** attrs )
170
170
mock_subprocess_popen .return_value = process_mock
171
- cmd = SubprocessCommand (* args , cwd = tmp_path , ** kwargs )
171
+ kwargs ["cwd" ] = tmp_path
172
+ cmd = SubprocessCommand (* args , ** kwargs )
172
173
response = cmd .Popen (** run_kwargs )
173
174
174
175
assert response .returncode == 1
@@ -194,7 +195,8 @@ def test_Popen_git_mock(
194
195
attrs = {"communicate.return_value" : ("output" , "error" ), "returncode" : 1 }
195
196
process_mock .configure_mock (** attrs )
196
197
mock_subprocess_popen .return_value = process_mock
197
- cmd = SubprocessCommand (* args , cwd = tmp_path , ** kwargs )
198
+ kwargs ["cwd" ] = tmp_path
199
+ cmd = SubprocessCommand (* args , ** kwargs )
198
200
response = cmd .Popen (** run_kwargs )
199
201
200
202
stdout , stderr = response .communicate ()
@@ -262,9 +264,10 @@ def test_CaptureStderrMixin(
262
264
)
263
265
response = cmd .Popen ()
264
266
while response .poll () is None :
265
- line = response .stderr .readline ().decode ("utf-8" ).strip ()
266
- if line :
267
- assert line .startswith ("[" )
267
+ if response .stderr is not None :
268
+ line = response .stderr .readline ().decode ("utf-8" ).strip ()
269
+ if line :
270
+ assert line .startswith ("[" )
268
271
assert response .returncode == 0
269
272
270
273
@@ -289,8 +292,9 @@ def test_CaptureStderrMixin_error(
289
292
)
290
293
response = cmd .Popen ()
291
294
while response .poll () is None :
292
- line = response .stderr .readline ().decode ("utf-8" ).strip ()
293
- if line :
294
- assert line .startswith ("[" ) or line == "FATAL"
295
+ if response .stderr is not None :
296
+ line = response .stderr .readline ().decode ("utf-8" ).strip ()
297
+ if line :
298
+ assert line .startswith ("[" ) or line == "FATAL"
295
299
296
300
assert response .returncode == 1
0 commit comments