@@ -264,11 +264,14 @@ def error_on_legacy_suite_names(args):
264
264
utils .exit_with_error ('`%s` test suite has been replaced with `%s`' , a , new )
265
265
266
266
267
- def load_test_suites (args , modules ):
267
+ def load_test_suites (args , modules , start_at ):
268
+ found_start = not start_at
269
+
268
270
loader = unittest .TestLoader ()
269
271
error_on_legacy_suite_names (args )
270
272
unmatched_test_names = set (args )
271
273
suites = []
274
+
272
275
total_tests = 0
273
276
for m in modules :
274
277
names_in_module = []
@@ -282,11 +285,19 @@ def load_test_suites(args, modules):
282
285
if len (names_in_module ):
283
286
loaded_tests = loader .loadTestsFromNames (sorted (names_in_module ), m )
284
287
tests = flattened_tests (loaded_tests )
285
- total_tests += len (tests )
286
288
suite = suite_for_module (m , tests )
287
289
for test in tests :
290
+ if not found_start :
291
+ # Skip over tests until we find the start
292
+ if test .id ().endswith (start_at ):
293
+ found_start = True
294
+ else :
295
+ continue
296
+ total_tests += 1
288
297
suite .addTest (test )
289
298
suites .append ((m .__name__ , suite ))
299
+ if not found_start :
300
+ utils .exit_with_error (f'unable to find --start-at test: { start_at } ' )
290
301
if total_tests == 1 or parallel_testsuite .num_cores () == 1 :
291
302
common .EMTEST_SAVE_DIR = True
292
303
return suites , unmatched_test_names
@@ -360,18 +371,17 @@ def parse_args(args):
360
371
parser .add_argument ('--all-engines' , action = 'store_true' , default = None )
361
372
parser .add_argument ('--detect-leaks' , action = 'store_true' , default = None )
362
373
parser .add_argument ('--skip-slow' , action = 'store_true' , help = 'Skip tests marked as slow' )
363
- parser .add_argument ('--cores' ,
374
+ parser .add_argument ('--cores' , '-j' ,
364
375
help = 'Set the number tests to run in parallel. Defaults '
365
376
'to the number of CPU cores.' , default = None )
366
377
parser .add_argument ('--rebaseline' , action = 'store_true' , default = None ,
367
378
help = 'Automatically update test expectations for tests that support it.' )
368
379
parser .add_argument ('--browser' ,
369
380
help = 'Command to launch web browser in which to run browser tests.' )
370
381
parser .add_argument ('tests' , nargs = '*' )
371
- parser .add_argument ('--failfast' , dest = 'failfast' , action = 'store_const' ,
372
- const = True , default = False )
373
- parser .add_argument ('--force64' , dest = 'force64' , action = 'store_const' ,
374
- const = True , default = None )
382
+ parser .add_argument ('--failfast' , action = 'store_const' , const = True , default = False )
383
+ parser .add_argument ('--start-at' , metavar = 'NAME' , help = 'Skip all tests up until <NAME>' )
384
+ parser .add_argument ('--force64' , action = 'store_const' , const = True , default = None )
375
385
parser .add_argument ('--crossplatform-only' , action = 'store_true' )
376
386
return parser .parse_args ()
377
387
@@ -453,7 +463,7 @@ def prepend_default(arg):
453
463
tests = tests_with_expanded_wildcards (tests , all_tests )
454
464
tests = skip_requested_tests (tests , modules )
455
465
tests = args_for_random_tests (tests , modules )
456
- suites , unmatched_tests = load_test_suites (tests , modules )
466
+ suites , unmatched_tests = load_test_suites (tests , modules , options . start_at )
457
467
if unmatched_tests :
458
468
print ('ERROR: could not find the following tests: ' + ' ' .join (unmatched_tests ))
459
469
return 1
0 commit comments