aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2025-10-30 16:36:45 +0000
committerdirkf <fieldhouse@gmx.net>2025-11-21 01:52:11 +0000
commit014ae63a11d6f8647e262ed25d68f1e4aab9ae20 (patch)
tree568964b5afead7e8de7dd47e34d2847ca31956ad /test
parent1e109aaee13a30e2a23f982410ffb3e4f73913df (diff)
[test] Support additional args and kwargs in report_warning() mocks
Diffstat (limited to 'test')
-rw-r--r--test/helper.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/helper.py b/test/helper.py
index 6f2129eff..fac069d25 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -85,10 +85,10 @@ class FakeYDL(YoutubeDL):
# Silence an expected warning matching a regex
old_report_warning = self.report_warning
- def report_warning(self, message):
+ def report_warning(self, message, *args, **kwargs):
if re.match(regex, message):
return
- old_report_warning(message)
+ old_report_warning(message, *args, **kwargs)
self.report_warning = types.MethodType(report_warning, self)
@@ -265,11 +265,11 @@ def assertRegexpMatches(self, text, regexp, msg=None):
def expect_warnings(ydl, warnings_re):
real_warning = ydl.report_warning
- def _report_warning(w):
+ def _report_warning(self, w, *args, **kwargs):
if not any(re.search(w_re, w) for w_re in warnings_re):
real_warning(w)
- ydl.report_warning = _report_warning
+ ydl.report_warning = types.MethodType(_report_warning, ydl)
def http_server_port(httpd):