From: Ben Darnell Date: Fri, 7 Aug 2015 16:07:58 +0000 (-0400) Subject: Add more warnings filters in twisted_test. X-Git-Tag: v4.3.0b1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=943003d7997b27a93a2788038421a887a726b19e;p=thirdparty%2Ftornado.git Add more warnings filters in twisted_test. Necessary for green builds with Twisted 15.3 on Python 3.x. --- diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 22410567a..c921c5fb1 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -630,6 +630,24 @@ if have_twisted: os.chdir(self.__curdir) shutil.rmtree(self.__tempdir) + def flushWarnings(self, *args, **kwargs): + # This is a hack because Twisted and Tornado have + # differing approaches to warnings in tests. + # Tornado sets up a global set of warnings filters + # in runtests.py, while Twisted patches the filter + # list in each test. The net effect is that + # Twisted's tests run with Tornado's increased + # strictness (BytesWarning and ResourceWarning are + # enabled) but without our filter rules to ignore those + # warnings from Twisted code. + filtered = [] + for w in super(TornadoTest, self).flushWarnings( + *args, **kwargs): + if w['category'] in (BytesWarning, ResourceWarning): + continue + filtered.append(w) + return filtered + def buildReactor(self): self.__saved_signals = save_signal_handlers() return test_class.buildReactor(self)