changeset 14337:439ed4721a6d

run-tests: ignore timeout when Popen.terminate is unavailable Popen.terminate was introduced in python 2.6
author Patrick Mezard <pmezard@gmail.com>
date Mon, 16 May 2011 21:41:46 +0200
parents 0cbf0d1f7939
children 862f8cd87546
files tests/run-tests.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon May 16 21:26:50 2011 +0200
+++ b/tests/run-tests.py	Mon May 16 21:41:46 2011 +0200
@@ -73,8 +73,8 @@
     p.tochild = p.stdin
     p.childerr = p.stderr
 
+    p.timeout = False
     if timeout:
-        p.timeout = False
         def t():
             start = time.time()
             while time.time() - start < timeout and p.returncode is None:
@@ -242,6 +242,10 @@
             sys.stderr.write(
                 'warning: --timeout option ignored with --debug\n')
         options.timeout = 0
+    if options.timeout and not hasattr(subprocess.Popen, 'terminate'):
+        sys.stderr.write('warning: timeout is not supported on this '
+                         'platform and will be ignored')
+        options.timeout = 0
     if options.py3k_warnings:
         if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
             parser.error('--py3k-warnings can only be used on Python 2.6+')