]> granicus.if.org Git - python/commitdiff
Use a sleep for test_subprocess timeout test
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 6 Jun 2011 21:43:02 +0000 (23:43 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 6 Jun 2011 21:43:02 +0000 (23:43 +0200)
instead of an active loop (while True: pass) to limit race conditions.

Lib/test/test_subprocess.py

index 7d4ca2cd00dfef4ed0e784f80164fac35fd3ffc7..b52d8e8f84abd3c53a8f9c6ec9bf908960471418 100644 (file)
@@ -127,9 +127,10 @@ class ProcessTestCase(BaseTestCase):
         with self.assertRaises(subprocess.TimeoutExpired) as c:
             output = subprocess.check_output(
                     [sys.executable, "-c",
-                     "import sys; sys.stdout.write('BDFL')\n"
+                     "import sys, time\n"
+                     "sys.stdout.write('BDFL')\n"
                      "sys.stdout.flush()\n"
-                     "while True: pass"],
+                     "time.sleep(3600)"],
                     # Some heavily loaded buildbots (sparc Debian 3.x) require
                     # this much time to start and print.
                     timeout=3)