[Python-checkins] cpython: Use a sleep for test_subprocess timeout test

victor.stinner python-checkins at python.org
Mon Jun 6 23:44:52 CEST 2011


http://hg.python.org/cpython/rev/509622ce587a
changeset:   70693:509622ce587a
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon Jun 06 23:43:02 2011 +0200
summary:
  Use a sleep for test_subprocess timeout test

instead of an active loop (while True: pass) to limit race conditions.

files:
  Lib/test/test_subprocess.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -127,9 +127,10 @@
         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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list