prevent test failure when there's no 'ytdl' module (#4364)

split of ytdl into its own test function and
skip it when there's an ImportError similar to test_ytdl.py
pull/4403/head
Mike Fährmann 1 year ago
parent 48ef062867
commit d50c312ff0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -135,12 +135,25 @@ class TestExtractorModule(unittest.TestCase):
def test_init(self):
"""Test for exceptions in Extractor.initialize(()"""
for cls in extractor.extractors():
if cls.category == "ytdl":
continue
for test in cls._get_tests():
extr = cls.from_url(test[0])
extr.initialize()
extr.finalize()
break
def test_init_ytdl(self):
try:
extr = extractor.find("ytdl:")
extr.initialize()
extr.finalize()
except ImportError as exc:
if exc.name in ("youtube_dl", "yt_dlp"):
raise unittest.SkipTest("cannot import module '{}'".format(
exc.name))
raise
def test_docstrings(self):
"""Ensure docstring uniqueness"""
for extr1 in extractor.extractors():

Loading…
Cancel
Save