Skip to content

Commit 9063e79

Browse files
committed
[tests] test_subprocess maybe avoid a timeout race condition?
The few buildbot failures on python#133103 are possibly just due to racing a child process launch and exit?
1 parent 2bbcaed commit 9063e79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_subprocess.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ def test_call_timeout(self):
164164

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

0 commit comments

Comments
 (0)