From: Gregory P. Smith Date: Mon, 5 May 2025 04:02:16 +0000 (-0700) Subject: [tests] test_subprocess maybe avoid a timeout race condition? (#133420) X-Git-Tag: v3.14.0b1~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b64aa302d7bc09454ba8d5b19922ff6a4192dd96;p=thirdparty%2FPython%2Fcpython.git [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? --- diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index d2db8fbcb64d..ca35804fb360 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -164,13 +164,13 @@ class ProcessTestCase(BaseTestCase): 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: