From 5f69fc249e2ec1a25705106539814a54fb8d69dd Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 4 May 2025 21:02:16 -0700 Subject: [PATCH] [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 --- Lib/test/test_subprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index ba02b1a1c011a1..8b2f48b0fc0119 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -163,13 +163,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: