@@ -73,11 +73,14 @@ _bname = os.path.basename
73
73
class ComplianceTestRunner (object ):
74
74
TEST_DIR = _pjoin (_dname (_dname (_abs (__file__ ))), 'tests' )
75
75
76
- def __init__ (self , exe = None , tests = None , test_dir = None ):
76
+ def __init__ (self , exe = None , tests = None , test_dir = None , exclude = None ):
77
77
if test_dir is None :
78
78
test_dir = self .TEST_DIR
79
79
self .test_dir = test_dir
80
80
self .tests = tests
81
+ self .excludes = []
82
+ if exclude != None :
83
+ self .excludes = exclude .split (',' )
81
84
self .jp_executable = exe
82
85
self .had_failures = False
83
86
@@ -227,8 +230,9 @@ class ComplianceTestRunner(object):
227
230
for root , _ , filenames in os .walk (self .test_dir ):
228
231
for filename in filenames :
229
232
if filename .endswith ('.json' ):
230
- full_path = _pjoin (root , filename )
231
- yield full_path
233
+ if not (filename in [item + '.json' for item in self .excludes ]):
234
+ full_path = _pjoin (root , filename )
235
+ yield full_path
232
236
233
237
234
238
def display_available_tests (test_files ):
@@ -266,8 +270,10 @@ def main():
266
270
'specified, no tests will actually be run.' ))
267
271
parser .add_argument ('-s' , '--stop-first-fail' , action = 'store_true' ,
268
272
help = 'Stop running tests after a single test fails.' )
273
+ parser .add_argument ('-x' , '--exclude' ,
274
+ help = 'Exclude tests from running.' )
269
275
args = parser .parse_args ()
270
- runner = ComplianceTestRunner (args .exe , args .tests , args .test_dir )
276
+ runner = ComplianceTestRunner (args .exe , args .tests , args .test_dir , args . exclude )
271
277
if args .list :
272
278
display_available_tests (runner .get_compliance_test_files ())
273
279
else :
0 commit comments