about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-07 18:45:31 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-18 10:50:46 +0100
commitd5ef405c5d533c85cebd205a5b7958614c7013f3 (patch)
treea358f3ab775a1808c25e09e71b42da61286f8a14 /test
parentf47fdb9564d3ca1c0fa70ed6031148ec908fdc7b (diff)
downloadyoutube-dl-d5ef405c5d533c85cebd205a5b7958614c7013f3.tar.gz
youtube-dl-d5ef405c5d533c85cebd205a5b7958614c7013f3.tar.xz
youtube-dl-d5ef405c5d533c85cebd205a5b7958614c7013f3.zip
[core] Align error reporting methods with yt-dlp
Diffstat (limited to 'test')
-rw-r--r--test/helper.py3
-rw-r--r--test/test_YoutubeDL.py10
2 files changed, 4 insertions, 9 deletions
diff --git a/test/helper.py b/test/helper.py
index 883b2e877..e3314b03e 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -72,7 +72,8 @@ class FakeYDL(YoutubeDL):
     def to_screen(self, s, skip_eol=None):
         print(s)
 
-    def trouble(self, s, tb=None):
+    def trouble(self, *args, **kwargs):
+        s = args[0] if len(args) > 0 else kwargs.get('message', 'Missing message')
         raise Exception(s)
 
     def download(self, x):
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index f8c8e619c..60780b8a7 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -930,17 +930,11 @@ class TestYoutubeDL(unittest.TestCase):
     # Test case for https://github.com/ytdl-org/youtube-dl/issues/27064
     def test_ignoreerrors_for_playlist_with_url_transparent_iterable_entries(self):
 
-        class _YDL(YDL):
-            def __init__(self, *args, **kwargs):
-                super(_YDL, self).__init__(*args, **kwargs)
-
-            def trouble(self, s, tb=None):
-                pass
-
-        ydl = _YDL({
+        ydl = YDL({
             'format': 'extra',
             'ignoreerrors': True,
         })
+        ydl.trouble = lambda *_, **__: None
 
         class VideoIE(InfoExtractor):
             _VALID_URL = r'video:(?P<id>\d+)'