aboutsummaryrefslogtreecommitdiff
path: root/test/helper.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-10-26 20:49:51 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-10-26 20:49:51 +0100
commit70b7e3fbb62e9bec12328bb9d506327fe77a85c0 (patch)
tree068f04c0b62689333d0fb3546bef835f7807bc1a /test/helper.py
parent579657ad8726ab0cdefd98fbbb28f09fbcf94e96 (diff)
downloadyoutube-dl-70b7e3fbb62e9bec12328bb9d506327fe77a85c0.tar.xz
[generic] Add a test case for direct links with broken HEAD (#4032)
Diffstat (limited to 'test/helper.py')
-rw-r--r--test/helper.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/helper.py b/test/helper.py
index 2fa45631a..fb8618120 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -171,3 +171,13 @@ def assertGreaterEqual(self, got, expected, msg=None):
if msg is None:
msg = '%r not greater than or equal to %r' % (got, expected)
self.assertTrue(got >= expected, msg)
+
+
+def expect_warnings(ydl, warnings_re):
+ real_warning = ydl.report_warning
+
+ def _report_warning(w):
+ if not any(re.search(w_re, w) for w_re in warnings_re):
+ real_warning(w)
+
+ ydl.report_warning = _report_warning