mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-28 09:31:01 +01:00
Move testcase generator to helper
This commit is contained in:
parent
20db33e299
commit
fc2c063e1e
@ -2,6 +2,7 @@
|
|||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
import youtube_dl.extractor
|
||||||
from youtube_dl import YoutubeDL, YoutubeDLHandler
|
from youtube_dl import YoutubeDL, YoutubeDLHandler
|
||||||
from youtube_dl.utils import (
|
from youtube_dl.utils import (
|
||||||
compat_cookiejar,
|
compat_cookiejar,
|
||||||
@ -31,3 +32,13 @@ def trouble(self, s, tb=None):
|
|||||||
raise Exception(s)
|
raise Exception(s)
|
||||||
def download(self, x):
|
def download(self, x):
|
||||||
self.result.append(x)
|
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 t
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import youtube_dl.extractor
|
import youtube_dl.extractor
|
||||||
from youtube_dl.utils import *
|
from 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")
|
PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json")
|
||||||
|
|
||||||
RETRIES = 3
|
RETRIES = 3
|
||||||
@ -56,17 +55,8 @@ def _file_md5(fn):
|
|||||||
with open(fn, 'rb') as f:
|
with open(fn, 'rb') as f:
|
||||||
return hashlib.md5(f.read()).hexdigest()
|
return hashlib.md5(f.read()).hexdigest()
|
||||||
|
|
||||||
with io.open(DEF_FILE, encoding='utf-8') as deff:
|
from helper import get_testcases
|
||||||
defs = json.load(deff)
|
defs = get_testcases()
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
with io.open(PARAMETERS_FILE, encoding='utf-8') as pf:
|
with io.open(PARAMETERS_FILE, encoding='utf-8') as pf:
|
||||||
parameters = json.load(pf)
|
parameters = json.load(pf)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
[]
|
|
Loading…
Reference in New Issue
Block a user