Skip to content

Commit 9f225e2

Browse files
authored
gh-150436: Check returncode in Win32ProcessTestCase (#150972)
1 parent 9b4090c commit 9f225e2

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

Lib/test/test_subprocess.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,8 +3719,9 @@ def test_startupinfo(self):
37193719
# Since Python is a console process, it won't be affected
37203720
# by wShowWindow, but the argument should be silently
37213721
# ignored
3722-
subprocess.call(ZERO_RETURN_CMD,
3723-
startupinfo=startupinfo)
3722+
rc = subprocess.call(ZERO_RETURN_CMD,
3723+
startupinfo=startupinfo)
3724+
self.assertEqual(rc, 0)
37243725

37253726
def test_startupinfo_keywords(self):
37263727
# startupinfo argument
@@ -3735,8 +3736,9 @@ def test_startupinfo_keywords(self):
37353736
# Since Python is a console process, it won't be affected
37363737
# by wShowWindow, but the argument should be silently
37373738
# ignored
3738-
subprocess.call(ZERO_RETURN_CMD,
3739-
startupinfo=startupinfo)
3739+
rc = subprocess.call(ZERO_RETURN_CMD,
3740+
startupinfo=startupinfo)
3741+
self.assertEqual(rc, 0)
37403742

37413743
def test_startupinfo_copy(self):
37423744
# bpo-34044: Popen must not modify input STARTUPINFO structure
@@ -3853,14 +3855,16 @@ def test_close_fds_with_stdio(self):
38533855
def test_empty_attribute_list(self):
38543856
startupinfo = subprocess.STARTUPINFO()
38553857
startupinfo.lpAttributeList = {}
3856-
subprocess.call(ZERO_RETURN_CMD,
3857-
startupinfo=startupinfo)
3858+
rc = subprocess.call(ZERO_RETURN_CMD,
3859+
startupinfo=startupinfo)
3860+
self.assertEqual(rc, 0)
38583861

38593862
def test_empty_handle_list(self):
38603863
startupinfo = subprocess.STARTUPINFO()
38613864
startupinfo.lpAttributeList = {"handle_list": []}
3862-
subprocess.call(ZERO_RETURN_CMD,
3863-
startupinfo=startupinfo)
3865+
rc = subprocess.call(ZERO_RETURN_CMD,
3866+
startupinfo=startupinfo)
3867+
self.assertEqual(rc, 0)
38643868

38653869
def test_shell_sequence(self):
38663870
# Run command through the shell (sequence)
@@ -3871,6 +3875,8 @@ def test_shell_sequence(self):
38713875
env=newenv)
38723876
with p:
38733877
self.assertIn(b"physalis", p.stdout.read())
3878+
p.communicate()
3879+
self.assertEqual(p.returncode, 0)
38743880

38753881
def test_shell_string(self):
38763882
# Run command through the shell (string)
@@ -3881,6 +3887,8 @@ def test_shell_string(self):
38813887
env=newenv)
38823888
with p:
38833889
self.assertIn(b"physalis", p.stdout.read())
3890+
p.communicate()
3891+
self.assertEqual(p.returncode, 0)
38843892

38853893
def test_shell_encodings(self):
38863894
# Run command through the shell (string)
@@ -3893,6 +3901,8 @@ def test_shell_encodings(self):
38933901
encoding=enc)
38943902
with p:
38953903
self.assertIn("physalis", p.stdout.read(), enc)
3904+
p.communicate()
3905+
self.assertEqual(p.returncode, 0)
38963906

38973907
def test_call_string(self):
38983908
# call() function with string argument on Windows

0 commit comments

Comments
 (0)