comparison tests/run-tests.py @ 9407:19d91a23458c

run-tests: use parser.error for cmdline option errors
author Martin Geisler <mg@lazybytes.net>
date Fri, 28 Aug 2009 20:50:54 +0200
parents 31203db1b2ac
children 70bf7f853adc
comparison
equal deleted inserted replaced
9406:a4b761751919 9407:19d91a23458c
174 except OSError, err: 174 except OSError, err:
175 if err.errno != errno.EEXIST: 175 if err.errno != errno.EEXIST:
176 raise 176 raise
177 177
178 if options.jobs < 1: 178 if options.jobs < 1:
179 print >> sys.stderr, 'ERROR: -j/--jobs must be positive' 179 parser.error('-j/--jobs must be positive')
180 sys.exit(1)
181 if options.interactive and options.jobs > 1: 180 if options.interactive and options.jobs > 1:
182 print '(--interactive overrides --jobs)' 181 print '(--interactive overrides --jobs)'
183 options.jobs = 1 182 options.jobs = 1
184 if options.py3k_warnings: 183 if options.py3k_warnings:
185 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): 184 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
186 print 'ERROR: Py3k warnings switch can only be used on Python 2.6+' 185 parser.error('Py3k warnings switch can only be used on Python 2.6+')
187 sys.exit(1)
188 186
189 return (options, args) 187 return (options, args)
190 188
191 def rename(src, dst): 189 def rename(src, dst):
192 """Like os.rename(), trade atomicity and opened files friendliness 190 """Like os.rename(), trade atomicity and opened files friendliness