From d1f90bb4244158e1fcfbab5195cf35cad5d9906a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 9 Dec 2016 00:25:52 +0100 Subject: [PATCH] add method to re-create existing test-data --- test/create_test_data.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/create_test_data.py b/test/create_test_data.py index 25db6c48..d331f98f 100644 --- a/test/create_test_data.py +++ b/test/create_test_data.py @@ -10,7 +10,7 @@ """Create testdata for extractor tests""" import argparse -from gallery_dl import job, config +from gallery_dl import job, config, extractor TESTDATA_FMT = """ test = [("{}", {{ @@ -23,11 +23,21 @@ TESTDATA_FMT = """ def main(): parser = argparse.ArgumentParser() parser.add_argument("--content", action="store_true") + parser.add_argument("--recreate", action="store_true") parser.add_argument("urls", nargs="*") args = parser.parse_args() + if args.recreate: + urls = [ + test[0] + for extr in extractor.extractors() if extr.category in args.urls + for test in extr.test + ] + else: + urls = args.urls + config.load() - for url in args.urls: + for url in urls: hjob = job.HashJob(url, content=args.content) hjob.run() print(hjob.extractor.__class__.__name__)