##// END OF EJS Templates
tests: add -R switch...
Matt Mackall -
r3625:cc0cd594 default
parent child Browse files
Show More
@@ -36,6 +36,8 b' parser.add_option("-r", "--retest", acti'
36 help="retest failed tests")
36 help="retest failed tests")
37 parser.add_option("-f", "--first", action="store_true",
37 parser.add_option("-f", "--first", action="store_true",
38 help="exit on the first test failure")
38 help="exit on the first test failure")
39 parser.add_option("-R", "--restart", action="store_true",
40 help="restart at last error")
39
41
40 parser.set_defaults(timeout=180)
42 parser.set_defaults(timeout=180)
41 (options, args) = parser.parse_args()
43 (options, args) = parser.parse_args()
@@ -355,7 +357,7 b' try:'
355 print 'WARNING: cannot run tests with timeouts'
357 print 'WARNING: cannot run tests with timeouts'
356 options.timeout = 0
358 options.timeout = 0
357
359
358 tests = 0
360 tested = 0
359 failed = 0
361 failed = 0
360 skipped = 0
362 skipped = 0
361
363
@@ -363,10 +365,25 b' try:'
363 args = os.listdir(".")
365 args = os.listdir(".")
364 args.sort()
366 args.sort()
365
367
368
369 tests = []
366 for test in args:
370 for test in args:
367 if (test.startswith("test-") and '~' not in test and
371 if (test.startswith("test-") and '~' not in test and
368 ('.' not in test or test.endswith('.py') or
372 ('.' not in test or test.endswith('.py') or
369 test.endswith('.bat'))):
373 test.endswith('.bat'))):
374 tests.append(test)
375
376 if options.restart:
377 orig = list(tests)
378 while tests:
379 if os.path.exists(tests[0] + ".err"):
380 break
381 tests.pop(0)
382 if not tests:
383 print "running all tests"
384 tests = orig
385
386 for test in tests:
370 if options.retest and not os.path.exists(test + ".err"):
387 if options.retest and not os.path.exists(test + ".err"):
371 skipped += 1
388 skipped += 1
372 continue
389 continue
@@ -377,9 +394,9 b' try:'
377 failed += 1
394 failed += 1
378 if options.first:
395 if options.first:
379 break
396 break
380 tests += 1
397 tested += 1
381
398
382 print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped,
399 print "\n# Ran %d tests, %d skipped, %d failed." % (tested, skipped,
383 failed)
400 failed)
384 if coverage:
401 if coverage:
385 output_coverage()
402 output_coverage()
General Comments 0
You need to be logged in to leave comments. Login now