From 9063e794daed99ad42d5d6efacbac82126f0c0fc Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Mon, 5 May 2025 03:28:18 +0000 Subject: [PATCH] [tests] test_subprocess maybe avoid a timeout race condition? The few buildbot failures on https://github.com/python/cpython/pull/133103 are possibly just due to racing a child process launch and exit? --- 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 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: