A feature-rich command-line audio/video downloader
Move testcase generator to helper
Philipp Hagemeisterfc2c063e1eeb
diff --git a/test/helper.py b/test/helper.pyindex 842ffc2fd3..a2b468b509 100644--- a/test/helper.py+++ b/test/helper.py@@ -2,6 +2,7 @@ import ioimport jsonimport os.path+import youtube_dl.extractorfrom youtube_dl import YoutubeDL, YoutubeDLHandlerfrom youtube_dl.utils import (compat_cookiejar,@@ -30,4 +31,14 @@ class FakeYDL(YoutubeDL):def trouble(self, s, tb=None):raise Exception(s)def download(self, x):- self.result.append(x)\ No newline at end of file+ self.result.append(x)++def get_testcases():+ for ie in youtube_dl.extractor.gen_extractors():+ t = getattr(ie, '_TEST', None)+ if t:+ t['name'] = type(ie).__name__[:-len('IE')]+ yield t+ for t in getattr(ie, '_TESTS', []):+ t['name'] = type(ie).__name__[:-len('IE')]+ yield tdiff --git a/test/test_download.py b/test/test_download.pyindex 019498f625..db43e99620 100644--- a/test/test_download.py+++ b/test/test_download.py@@ -17,7 +17,6 @@ import youtube_dl.YoutubeDLimport youtube_dl.extractorfrom youtube_dl.utils import *-DEF_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tests.json')PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json")RETRIES = 3@@ -56,17 +55,8 @@ def _file_md5(fn):with open(fn, 'rb') as f:return hashlib.md5(f.read()).hexdigest()-with io.open(DEF_FILE, encoding='utf-8') as deff:- defs = json.load(deff)-for ie in youtube_dl.extractor.gen_extractors():- t = getattr(ie, '_TEST', None)- if t:- t['name'] = type(ie).__name__[:-len('IE')]- defs.append(t)- for t in getattr(ie, '_TESTS', []):- t['name'] = type(ie).__name__[:-len('IE')]- defs.append(t)-+from helper import get_testcases+defs = get_testcases()with io.open(PARAMETERS_FILE, encoding='utf-8') as pf:parameters = json.load(pf)diff --git a/test/tests.json b/test/tests.jsondeleted file mode 100644index fe51488c70..0000000000--- a/test/tests.json+++ /dev/null@@ -1 +0,0 @@-[]