44
44
doing memory analysis on the Python interpreter, which process tends to
45
45
consume too many resources to run the full regression test non-stop.
46
46
47
- -S is used to continue running tests after an aborted run. It will
48
- maintain the order a standard run (ie, this assumes -r is not used).
47
+ -S is used to resume running tests after an interrupted run. It will
48
+ maintain the order a standard run (i.e. it assumes -r is not used).
49
49
This is useful after the tests have prematurely stopped for some external
50
- reason and you want to start running from where you left off rather
51
- than starting from the beginning.
50
+ reason and you want to resume the run from where you left off rather
51
+ than starting from the beginning. Note: this is different from --prioritize.
52
+
53
+ --prioritize is used to influence the order of selected tests, such that
54
+ the tests listed as an argument are executed first. This is especially
55
+ useful when combined with -j and -r to pin the longest-running tests
56
+ to start at the beginning of a test run. Pass --prioritize=test_a,test_b
57
+ to make test_a run first, followed by test_b, and then the other tests.
58
+ If test_a wasn't selected for execution by regular means, --prioritize will
59
+ not make it execute.
52
60
53
61
-f reads the names of tests from the file given as f's argument, one
54
62
or more test names per line. Whitespace is ignored. Blank lines and
@@ -236,7 +244,7 @@ def _create_parser():
236
244
help = 'wait for user input, e.g., allow a debugger '
237
245
'to be attached' )
238
246
group .add_argument ('-S' , '--start' , metavar = 'START' ,
239
- help = 'the name of the test at which to start .' +
247
+ help = 'resume an interrupted run at the following test .' +
240
248
more_details )
241
249
group .add_argument ('-p' , '--python' , metavar = 'PYTHON' ,
242
250
help = 'Command to run Python test subprocesses with.' )
@@ -263,6 +271,10 @@ def _create_parser():
263
271
group = parser .add_argument_group ('Selecting tests' )
264
272
group .add_argument ('-r' , '--randomize' , action = 'store_true' ,
265
273
help = 'randomize test execution order.' + more_details )
274
+ group .add_argument ('--prioritize' , metavar = 'TEST1,TEST2,...' ,
275
+ action = 'append' , type = priority_list ,
276
+ help = 'select these tests first, even if the order is'
277
+ ' randomized.' + more_details )
266
278
group .add_argument ('-f' , '--fromfile' , metavar = 'FILE' ,
267
279
help = 'read names of tests to run from a file.' +
268
280
more_details )
@@ -406,6 +418,10 @@ def resources_list(string):
406
418
return u
407
419
408
420
421
+ def priority_list (string ):
422
+ return string .split ("," )
423
+
424
+
409
425
def _parse_args (args , ** kwargs ):
410
426
# Defaults
411
427
ns = Namespace ()
@@ -551,4 +567,10 @@ def _parse_args(args, **kwargs):
551
567
print (msg , file = sys .stderr , flush = True )
552
568
sys .exit (2 )
553
569
570
+ ns .prioritize = [
571
+ test
572
+ for test_list in (ns .prioritize or ())
573
+ for test in test_list
574
+ ]
575
+
554
576
return ns
0 commit comments