https://github.com/python/cpython/commit/b64aa302d7bc09454ba8d5b19922ff6a4192dd96
commit: b64aa302d7bc09454ba8d5b19922ff6a4192dd96
branch: main
author: Gregory P. Smith <[email protected]>
committer: gpshead <[email protected]>
date: 2025-05-04T21:02:16-07:00
summary:

[tests] test_subprocess maybe avoid a timeout race condition? (#133420)

The few buildbot failures on https://github.com/python/cpython/pull/133103
are possibly just due to racing a child process launch and exit?

files:
M Lib/test/test_subprocess.py

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index d2db8fbcb64d52..ca35804fb36076 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -164,13 +164,13 @@ def test_call_timeout(self):
 
     def test_timeout_exception(self):
         try:
-            subprocess.run(['echo', 'hi'], timeout = -1)
+            subprocess.run([sys.executable, '-c', 'import 
time;time.sleep(9)'], timeout = -1)
         except subprocess.TimeoutExpired as e:
             self.assertIn("-1 seconds", str(e))
         else:
             self.fail("Expected TimeoutExpired exception not raised")
         try:
-            subprocess.run(['echo', 'hi'], timeout = 0)
+            subprocess.run([sys.executable, '-c', 'import 
time;time.sleep(9)'], timeout = 0)
         except subprocess.TimeoutExpired as e:
             self.assertIn("0 seconds", str(e))
         else:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to