@@ -267,7 +267,7 @@ def error_on_legacy_suite_names(args):
267
267
utils .exit_with_error ('`%s` test suite has been replaced with `%s`' , a , new )
268
268
269
269
270
- def load_test_suites (args , modules , start_at ):
270
+ def load_test_suites (args , modules , start_at , repeat ):
271
271
found_start = not start_at
272
272
273
273
loader = unittest .TestLoader ()
@@ -296,8 +296,9 @@ def load_test_suites(args, modules, start_at):
296
296
found_start = True
297
297
else :
298
298
continue
299
- total_tests += 1
300
- suite .addTest (test )
299
+ for _x in range (repeat ):
300
+ total_tests += 1
301
+ suite .addTest (test )
301
302
suites .append ((m .__name__ , suite ))
302
303
if not found_start :
303
304
utils .exit_with_error (f'unable to find --start-at test: { start_at } ' )
@@ -389,6 +390,8 @@ def parse_args(args):
389
390
'Useful when combined with --failfast' )
390
391
parser .add_argument ('--force64' , action = 'store_const' , const = True , default = None )
391
392
parser .add_argument ('--crossplatform-only' , action = 'store_true' )
393
+ parser .add_argument ('--repeat' , type = int , default = 1 ,
394
+ help = 'Repeat each test N times (default: 1).' )
392
395
return parser .parse_args ()
393
396
394
397
@@ -476,7 +479,7 @@ def prepend_default(arg):
476
479
if os .path .exists (common .LAST_TEST ):
477
480
options .start_at = utils .read_file (common .LAST_TEST ).strip ()
478
481
479
- suites , unmatched_tests = load_test_suites (tests , modules , options .start_at )
482
+ suites , unmatched_tests = load_test_suites (tests , modules , options .start_at , options . repeat )
480
483
if unmatched_tests :
481
484
print ('ERROR: could not find the following tests: ' + ' ' .join (unmatched_tests ))
482
485
return 1
0 commit comments