# HG changeset patch # User Patrick Mezard # Date 2011-05-16 19:41:46 # Node ID 439ed4721a6d630cd8f5c34a6ba7d5aca9e8ce7b # Parent 0cbf0d1f79392f69fe425365043f56980b709e55 run-tests: ignore timeout when Popen.terminate is unavailable Popen.terminate was introduced in python 2.6 diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -73,8 +73,8 @@ def Popen4(cmd, wd, timeout): 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 @@ def parseargs(): 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+')