Browse Source

use 'build_extractor_filter' in test_results.py

master
Mike Fährmann 6 months ago
parent
commit
b5b4f5a168
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
  1. 31
      test/test_results.py

31
test/test_results.py

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

Loading…
Cancel
Save