Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e89ca39

Browse files
[3.13] [tests] test_subprocess maybe avoid a timeout race condition? (GH-133420) (#133421)
[tests] test_subprocess maybe avoid a timeout race condition? (GH-133420) The few buildbot failures on #133103 are possibly just due to racing a child process launch and exit? (cherry picked from commit b64aa30) Co-authored-by: Gregory P. Smith <[email protected]>
1 parent 3d1b8e2 commit e89ca39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_subprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ def test_call_timeout(self):
163163

164164
def test_timeout_exception(self):
165165
try:
166-
subprocess.run(['echo', 'hi'], timeout = -1)
166+
subprocess.run([sys.executable, '-c', 'import time;time.sleep(9)'], timeout = -1)
167167
except subprocess.TimeoutExpired as e:
168168
self.assertIn("-1 seconds", str(e))
169169
else:
170170
self.fail("Expected TimeoutExpired exception not raised")
171171
try:
172-
subprocess.run(['echo', 'hi'], timeout = 0)
172+
subprocess.run([sys.executable, '-c', 'import time;time.sleep(9)'], timeout = 0)
173173
except subprocess.TimeoutExpired as e:
174174
self.assertIn("0 seconds", str(e))
175175
else:

0 commit comments

Comments
 (0)