mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
use 'build_extractor_filter' in test_results.py
This commit is contained in:
parent
6d190834ee
commit
b5b4f5a168
@ -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…
Reference in New Issue
Block a user