##// 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 36 help="retest failed tests")
37 37 parser.add_option("-f", "--first", action="store_true",
38 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 42 parser.set_defaults(timeout=180)
41 43 (options, args) = parser.parse_args()
@@ -355,7 +357,7 b' try:'
355 357 print 'WARNING: cannot run tests with timeouts'
356 358 options.timeout = 0
357 359
358 tests = 0
360 tested = 0
359 361 failed = 0
360 362 skipped = 0
361 363
@@ -363,10 +365,25 b' try:'
363 365 args = os.listdir(".")
364 366 args.sort()
365 367
368
369 tests = []
366 370 for test in args:
367 371 if (test.startswith("test-") and '~' not in test and
368 372 ('.' not in test or test.endswith('.py') or
369 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 387 if options.retest and not os.path.exists(test + ".err"):
371 388 skipped += 1
372 389 continue
@@ -377,9 +394,9 b' try:'
377 394 failed += 1
378 395 if options.first:
379 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 400 failed)
384 401 if coverage:
385 402 output_coverage()
General Comments 0
You need to be logged in to leave comments. Login now