Mercurial > hg
comparison tests/run-tests.py @ 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 |
comparison
equal
deleted
inserted
replaced
14336:0cbf0d1f7939 | 14337:439ed4721a6d |
---|---|
71 | 71 |
72 p.fromchild = p.stdout | 72 p.fromchild = p.stdout |
73 p.tochild = p.stdin | 73 p.tochild = p.stdin |
74 p.childerr = p.stderr | 74 p.childerr = p.stderr |
75 | 75 |
76 p.timeout = False | |
76 if timeout: | 77 if timeout: |
77 p.timeout = False | |
78 def t(): | 78 def t(): |
79 start = time.time() | 79 start = time.time() |
80 while time.time() - start < timeout and p.returncode is None: | 80 while time.time() - start < timeout and p.returncode is None: |
81 time.sleep(1) | 81 time.sleep(1) |
82 p.timeout = True | 82 p.timeout = True |
240 if options.debug: | 240 if options.debug: |
241 if options.timeout != defaults['timeout']: | 241 if options.timeout != defaults['timeout']: |
242 sys.stderr.write( | 242 sys.stderr.write( |
243 'warning: --timeout option ignored with --debug\n') | 243 'warning: --timeout option ignored with --debug\n') |
244 options.timeout = 0 | 244 options.timeout = 0 |
245 if options.timeout and not hasattr(subprocess.Popen, 'terminate'): | |
246 sys.stderr.write('warning: timeout is not supported on this ' | |
247 'platform and will be ignored') | |
248 options.timeout = 0 | |
245 if options.py3k_warnings: | 249 if options.py3k_warnings: |
246 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): | 250 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): |
247 parser.error('--py3k-warnings can only be used on Python 2.6+') | 251 parser.error('--py3k-warnings can only be used on Python 2.6+') |
248 if options.blacklist: | 252 if options.blacklist: |
249 blacklist = dict() | 253 blacklist = dict() |