3838-f/--fromfile -- read names of tests to run from a file (see below)
3939-x/--exclude -- arguments are tests to *exclude*
4040-s/--single -- single step through a set of tests (see below)
41+ -m/--match PAT -- match test cases and methods with glob pattern PAT
4142-G/--failfast -- fail as soon as a test fails (only with -v or -W)
4243-u/--use RES1,RES2,...
4344 -- specify which special resource intensive tests to run
@@ -242,7 +243,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
242243 findleaks = False , use_resources = None , trace = False , coverdir = 'coverage' ,
243244 runleaks = False , huntrleaks = False , verbose2 = False , print_slow = False ,
244245 random_seed = None , use_mp = None , verbose3 = False , forever = False ,
245- header = False , failfast = False ):
246+ header = False , failfast = False , match_tests = None ):
246247 """Execute a test suite.
247248
248249 This also parses command-line options and modifies its behavior
@@ -270,13 +271,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
270271
271272 support .record_original_stdout (sys .stdout )
272273 try :
273- opts , args = getopt .getopt (sys .argv [1 :], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:G ' ,
274+ opts , args = getopt .getopt (sys .argv [1 :], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:Gm: ' ,
274275 ['help' , 'verbose' , 'verbose2' , 'verbose3' , 'quiet' ,
275276 'exclude' , 'single' , 'slow' , 'random' , 'fromfile' , 'findleaks' ,
276277 'use=' , 'threshold=' , 'trace' , 'coverdir=' , 'nocoverdir' ,
277278 'runleaks' , 'huntrleaks=' , 'memlimit=' , 'randseed=' ,
278279 'multiprocess=' , 'coverage' , 'slaveargs=' , 'forever' , 'debug' ,
279- 'start=' , 'nowindows' , 'header' , 'failfast' ])
280+ 'start=' , 'nowindows' , 'header' , 'failfast' , 'match' ])
280281 except getopt .error as msg :
281282 usage (msg )
282283
@@ -318,6 +319,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
318319 random_seed = int (a )
319320 elif o in ('-f' , '--fromfile' ):
320321 fromfile = a
322+ elif o in ('-m' , '--match' ):
323+ match_tests = a
321324 elif o in ('-l' , '--findleaks' ):
322325 findleaks = True
323326 elif o in ('-L' , '--runleaks' ):
@@ -551,7 +554,7 @@ def tests_and_args():
551554 (test , verbose , quiet ),
552555 dict (huntrleaks = huntrleaks , use_resources = use_resources ,
553556 debug = debug , output_on_failure = verbose3 ,
554- failfast = failfast )
557+ failfast = failfast , match_tests = match_tests )
555558 )
556559 yield (test , args_tuple )
557560 pending = tests_and_args ()
@@ -630,7 +633,7 @@ def work():
630633 try :
631634 result = runtest (test , verbose , quiet , huntrleaks , debug ,
632635 output_on_failure = verbose3 ,
633- failfast = failfast )
636+ failfast = failfast , match_tests = match_tests )
634637 accumulate_result (test , result )
635638 except KeyboardInterrupt :
636639 interrupted = True
@@ -777,7 +780,7 @@ def restore_stdout():
777780
778781def runtest (test , verbose , quiet ,
779782 huntrleaks = False , debug = False , use_resources = None ,
780- output_on_failure = False , failfast = False ):
783+ output_on_failure = False , failfast = False , match_tests = None ):
781784 """Run a single test.
782785
783786 test -- the name of the test
@@ -800,6 +803,7 @@ def runtest(test, verbose, quiet,
800803 if use_resources is not None :
801804 support .use_resources = use_resources
802805 try :
806+ support .match_tests = match_tests
803807 if failfast :
804808 support .failfast = True
805809 if output_on_failure :
0 commit comments