Skip to content

Commit cb8d874

Browse files
committed
Handle ProcessLookupError with a try–except block, since it’s not always raised.
1 parent d8af14f commit cb8d874

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,12 @@ async def kill_running():
607607

608608
# kill the process (but asyncio is not notified immediately)
609609
proc.kill()
610-
with self.assertRaises(ProcessLookupError):
610+
try:
611611
proc.wait()
612+
except ProcessLookupError:
613+
# Process already exited, which is expected but not always
614+
# raised
615+
pass
612616

613617
proc.kill = mock.Mock()
614618
proc_returncode = proc.poll()

0 commit comments

Comments
 (0)