[common] only call 'skip()' & 'finalize()' when defined

This commit is contained in:
Mike Fährmann
2026-02-06 19:17:32 +01:00
parent 40e4cc62c4
commit 7a98a93a8e
3 changed files with 19 additions and 18 deletions

View File

@@ -160,13 +160,15 @@ class TestExtractorModule(unittest.TestCase):
extr.request = fail_request
extr.initialize()
extr.finalize()
if extr.finalize is not None:
extr.finalize(0)
def test_init_ytdl(self):
try:
extr = extractor.find("ytdl:")
extr.initialize()
extr.finalize()
if extr.finalize is not None:
extr.finalize(0)
except ImportError as exc:
if exc.name in ("youtube_dl", "yt_dlp"):
raise unittest.SkipTest(f"cannot import module '{exc.name}'")