Skip to content

Commit 58f85d4

Browse files
committed
Supports excluding tests.
1 parent 5d161a8 commit 58f85d4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

bin/jp-compliance

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ _bname = os.path.basename
7373
class ComplianceTestRunner(object):
7474
TEST_DIR = _pjoin(_dname(_dname(_abs(__file__))), 'tests')
7575

76-
def __init__(self, exe=None, tests=None, test_dir=None):
76+
def __init__(self, exe=None, tests=None, test_dir=None, exclude=None):
7777
if test_dir is None:
7878
test_dir = self.TEST_DIR
7979
self.test_dir = test_dir
8080
self.tests = tests
81+
self.excludes = []
82+
if exclude != None:
83+
self.excludes = exclude.split(',')
8184
self.jp_executable = exe
8285
self.had_failures = False
8386

@@ -227,8 +230,9 @@ class ComplianceTestRunner(object):
227230
for root, _, filenames in os.walk(self.test_dir):
228231
for filename in filenames:
229232
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
232236

233237

234238
def display_available_tests(test_files):
@@ -266,8 +270,10 @@ def main():
266270
'specified, no tests will actually be run.'))
267271
parser.add_argument('-s', '--stop-first-fail', action='store_true',
268272
help='Stop running tests after a single test fails.')
273+
parser.add_argument('-x', '--exclude',
274+
help='Exclude tests from running.')
269275
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)
271277
if args.list:
272278
display_available_tests(runner.get_compliance_test_files())
273279
else:

0 commit comments

Comments
 (0)