Show More
@@ -201,6 +201,11 b' def run(cmd):' | |||
|
201 | 201 | return ret, splitnewlines(output) |
|
202 | 202 | |
|
203 | 203 | def run_one(test): |
|
204 | '''tristate output: | |
|
205 | None -> skipped | |
|
206 | True -> passed | |
|
207 | False -> failed''' | |
|
208 | ||
|
204 | 209 | vlog("# Test", test) |
|
205 | 210 | if not verbose: |
|
206 | 211 | sys.stdout.write('.') |
@@ -217,15 +222,28 b' def run_one(test):' | |||
|
217 | 222 | os.mkdir(tmpd) |
|
218 | 223 | os.chdir(tmpd) |
|
219 | 224 | |
|
220 | if test.endswith(".py"): | |
|
225 | lctest = test.lower() | |
|
226 | ||
|
227 | if lctest.endswith('.py'): | |
|
221 | 228 | cmd = '%s "%s"' % (sys.executable, os.path.join(TESTDIR, test)) |
|
222 | else: | |
|
223 | cmd = '"%s"' % (os.path.join(TESTDIR, test)) | |
|
224 | ||
|
229 | elif lctest.endswith('.bat'): | |
|
230 | # do not run batch scripts on non-windows | |
|
231 | if os.name != 'nt': | |
|
232 | print '\nSkipping %s: batch script' % test | |
|
233 | return None | |
|
225 | 234 | # To reliably get the error code from batch files on WinXP, |
|
226 | 235 | # the "cmd /c call" prefix is needed. Grrr |
|
227 | if os.name == 'nt' and test.endswith(".bat"): | |
|
228 | 236 | cmd = 'cmd /c call "%s"' % (os.path.join(TESTDIR, test)) |
|
237 | else: | |
|
238 | # do not run shell scripts on windows | |
|
239 | if os.name == 'nt': | |
|
240 | print '\nSkipping %s: shell script' % test | |
|
241 | return None | |
|
242 | # do not try to run non-executable programs | |
|
243 | if not os.access(os.path.join(TESTDIR, test), os.X_OK): | |
|
244 | print '\nSkipping %s: not executable' % test | |
|
245 | return None | |
|
246 | cmd = '"%s"' % (os.path.join(TESTDIR, test)) | |
|
229 | 247 | |
|
230 | 248 | if options.timeout > 0: |
|
231 | 249 | signal.alarm(options.timeout) |
@@ -330,6 +348,7 b' try:' | |||
|
330 | 348 | |
|
331 | 349 | tests = 0 |
|
332 | 350 | failed = 0 |
|
351 | skipped = 0 | |
|
333 | 352 | |
|
334 | 353 | if len(args) == 0: |
|
335 | 354 | args = os.listdir(".") |
@@ -337,11 +356,15 b' try:' | |||
|
337 | 356 | if (test.startswith("test-") and '~' not in test and |
|
338 | 357 | ('.' not in test or test.endswith('.py') or |
|
339 | 358 | test.endswith('.bat'))): |
|
340 |
|
|
|
359 | ret = run_one(test) | |
|
360 | if ret is None: | |
|
361 | skipped += 1 | |
|
362 | elif not ret: | |
|
341 | 363 | failed += 1 |
|
342 | 364 | tests += 1 |
|
343 | 365 | |
|
344 |
print "\n# Ran %d tests, %d failed." % (tests, |
|
|
366 | print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped, | |
|
367 | failed) | |
|
345 | 368 | if coverage: |
|
346 | 369 | output_coverage() |
|
347 | 370 | except KeyboardInterrupt: |
General Comments 0
You need to be logged in to leave comments.
Login now