From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 5 May 2025 04:25:41 +0000 (+0200) Subject: [3.13] [tests] test_subprocess maybe avoid a timeout race condition? (GH-133420)... X-Git-Tag: v3.13.4~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e89ca3991c740a188006f82ff6ac38627cd5ef22;p=thirdparty%2FPython%2Fcpython.git [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 https://github.com/python/cpython/pull/133103 are possibly just due to racing a child process launch and exit? (cherry picked from commit b64aa302d7bc09454ba8d5b19922ff6a4192dd96) Co-authored-by: Gregory P. Smith --- diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index ba02b1a1c011..8b2f48b0fc01 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -163,13 +163,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: