mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 06:00:00 +00:00
[test] Fix FakeYDL
signatures
Authored by: coletdjnz
This commit is contained in:
parent
95032f302c
commit
f0500bd1e4
4 changed files with 13 additions and 13 deletions
|
@ -44,7 +44,7 @@ def try_rm(filename):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def report_warning(message):
|
def report_warning(message, *args, **kwargs):
|
||||||
'''
|
'''
|
||||||
Print the message to stderr, it will be prefixed with 'WARNING:'
|
Print the message to stderr, it will be prefixed with 'WARNING:'
|
||||||
If stderr is a tty file the 'WARNING:' will be colored
|
If stderr is a tty file the 'WARNING:' will be colored
|
||||||
|
@ -67,10 +67,10 @@ def __init__(self, override=None):
|
||||||
super().__init__(params, auto_init=False)
|
super().__init__(params, auto_init=False)
|
||||||
self.result = []
|
self.result = []
|
||||||
|
|
||||||
def to_screen(self, s, skip_eol=None):
|
def to_screen(self, s, *args, **kwargs):
|
||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
def trouble(self, s, tb=None):
|
def trouble(self, s, *args, **kwargs):
|
||||||
raise Exception(s)
|
raise Exception(s)
|
||||||
|
|
||||||
def download(self, x):
|
def download(self, x):
|
||||||
|
@ -80,10 +80,10 @@ def expect_warning(self, regex):
|
||||||
# Silence an expected warning matching a regex
|
# Silence an expected warning matching a regex
|
||||||
old_report_warning = self.report_warning
|
old_report_warning = self.report_warning
|
||||||
|
|
||||||
def report_warning(self, message):
|
def report_warning(self, message, *args, **kwargs):
|
||||||
if re.match(regex, message):
|
if re.match(regex, message):
|
||||||
return
|
return
|
||||||
old_report_warning(message)
|
old_report_warning(message, *args, **kwargs)
|
||||||
self.report_warning = types.MethodType(report_warning, self)
|
self.report_warning = types.MethodType(report_warning, self)
|
||||||
|
|
||||||
|
|
||||||
|
@ -301,9 +301,9 @@ def assertEqual(self, got, expected, msg=None):
|
||||||
def expect_warnings(ydl, warnings_re):
|
def expect_warnings(ydl, warnings_re):
|
||||||
real_warning = ydl.report_warning
|
real_warning = ydl.report_warning
|
||||||
|
|
||||||
def _report_warning(w):
|
def _report_warning(w, *args, **kwargs):
|
||||||
if not any(re.search(w_re, w) for w_re in warnings_re):
|
if not any(re.search(w_re, w) for w_re in warnings_re):
|
||||||
real_warning(w)
|
real_warning(w, *args, **kwargs)
|
||||||
|
|
||||||
ydl.report_warning = _report_warning
|
ydl.report_warning = _report_warning
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ def __init__(self, *args, **kwargs):
|
||||||
def process_info(self, info_dict):
|
def process_info(self, info_dict):
|
||||||
self.downloaded_info_dicts.append(info_dict.copy())
|
self.downloaded_info_dicts.append(info_dict.copy())
|
||||||
|
|
||||||
def to_screen(self, msg):
|
def to_screen(self, msg, *args, **kwargs):
|
||||||
self.msgs.append(msg)
|
self.msgs.append(msg)
|
||||||
|
|
||||||
def dl(self, *args, **kwargs):
|
def dl(self, *args, **kwargs):
|
||||||
|
|
|
@ -14,16 +14,16 @@
|
||||||
|
|
||||||
|
|
||||||
class Logger:
|
class Logger:
|
||||||
def debug(self, message):
|
def debug(self, message, *args, **kwargs):
|
||||||
print(f'[verbose] {message}')
|
print(f'[verbose] {message}')
|
||||||
|
|
||||||
def info(self, message):
|
def info(self, message, *args, **kwargs):
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
def warning(self, message, only_once=False):
|
def warning(self, message, *args, **kwargs):
|
||||||
self.error(message)
|
self.error(message)
|
||||||
|
|
||||||
def error(self, message):
|
def error(self, message, *args, **kwargs):
|
||||||
raise Exception(message)
|
raise Exception(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ def __init__(self, *args, **kwargs):
|
||||||
self.processed_info_dicts = []
|
self.processed_info_dicts = []
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def report_warning(self, message):
|
def report_warning(self, message, *args, **kwargs):
|
||||||
# Don't accept warnings during tests
|
# Don't accept warnings during tests
|
||||||
raise ExtractorError(message)
|
raise ExtractorError(message)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue