use 'build_extractor_filter' in test_results.py

pull/2197/head
Mike Fährmann 3 years ago
parent 6d190834ee
commit b5b4f5a168
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -353,28 +353,23 @@ def generate_tests():
# enable selective testing for direct calls # enable selective testing for direct calls
if __name__ == '__main__' and len(sys.argv) > 1: if __name__ == '__main__' and len(sys.argv) > 1:
if sys.argv[1].lower() == "all": categories = sys.argv[1:]
fltr = lambda c, bc: True # noqa: E731 negate = False
elif sys.argv[1].lower() == "broken": if categories[0].lower() == "all":
fltr = lambda c, bc: c in BROKEN # noqa: E731 categories = ()
else: negate = True
argv = sys.argv[1:] elif categories[0].lower() == "broken":
fltr = lambda c, bc: c in argv or bc in argv # noqa: E731 categories = BROKEN
del sys.argv[1:] del sys.argv[1:]
else: else:
skip = set(BROKEN) categories = BROKEN
if skip: negate = True
print("skipping:", ", ".join(skip)) if categories:
fltr = lambda c, bc: c not in skip # noqa: E731 print("skipping:", ", ".join(categories))
fltr = util.build_extractor_filter(categories, negate=negate)
# filter available extractor classes
extractors = [
extr for extr in extractor.extractors()
if fltr(extr.category, extr.basecategory)
]
# add 'test_...' methods # add 'test_...' methods
for extr in extractors: for extr in filter(fltr, extractor.extractors()):
name = "test_" + extr.__name__ + "_" name = "test_" + extr.__name__ + "_"
for num, tcase in enumerate(extr._get_tests(), 1): for num, tcase in enumerate(extr._get_tests(), 1):
test = _generate_test(extr, tcase) test = _generate_test(extr, tcase)

Loading…
Cancel
Save