]> jfr.im git - yt-dlp.git/blobdiff - test/test_post_hooks.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / test / test_post_hooks.py
index 63500924e9a3500c5b6fc673f51011b634bbb555..6500dd3863deb3ce3d978aed8a20db8cf301f1d2 100644 (file)
@@ -1,20 +1,21 @@
-#!/usr/bin/env python
-
-from __future__ import unicode_literals
+#!/usr/bin/env python3
 
+# Allow direct execution
 import os
 import sys
 import unittest
+
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
-from test.helper import get_params, try_rm
-import youtube_dlc.YoutubeDL
-from youtube_dlc.utils import DownloadError
+
+from test.helper import get_params, is_download_test, try_rm
+import yt_dlp.YoutubeDL  # isort: split
+from yt_dlp.utils import DownloadError
 
 
-class YoutubeDL(youtube_dlc.YoutubeDL):
+class YoutubeDL(yt_dlp.YoutubeDL):
     def __init__(self, *args, **kwargs):
-        super(YoutubeDL, self).__init__(*args, **kwargs)
+        super().__init__(*args, **kwargs)
         self.to_stderr = self.to_screen
 
 
@@ -22,6 +23,7 @@ def __init__(self, *args, **kwargs):
 EXPECTED_NAME = 'gr51aVj-mLg'
 
 
+@is_download_test
 class TestPostHooks(unittest.TestCase):
     def setUp(self):
         self.stored_name_1 = None
@@ -57,7 +59,7 @@ def hook_two(self, filename):
 
     def hook_three(self, filename):
         self.files.append(filename)
-        raise Exception('Test exception for \'%s\'' % filename)
+        raise Exception(f'Test exception for \'{filename}\'')
 
     def tearDown(self):
         for f in self.files: