X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=test%2Fhelper.py;h=325f72f0a35c5c4fe6ac3a1464858b200c152aad;hb=12ea2f30cfcc381eb46cc99a0a4c3d468fe732d1;hp=2fa45631adba0144bf0260117c33f944e53f66eb;hpb=f889cea109b4e2647e3fd6a462c9893b88b21e04;p=youtube-dl diff --git a/test/helper.py b/test/helper.py index 2fa45631a..325f72f0a 100644 --- a/test/helper.py +++ b/test/helper.py @@ -57,7 +57,7 @@ class FakeYDL(YoutubeDL): # Different instances of the downloader can't share the same dictionary # some test set the "sublang" parameter, which would break the md5 checks. params = get_params(override=override) - super(FakeYDL, self).__init__(params) + super(FakeYDL, self).__init__(params, auto_init=False) self.result = [] def to_screen(self, s, skip_eol=None): @@ -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