From: Ben Darnell Date: Mon, 23 Oct 2017 03:36:30 +0000 (-0400) Subject: twisted: Be more tolerant of leaked current IOLoops in tests X-Git-Tag: v5.0.0~45^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fb845db0b2d2c78d53d8e0cdc2ed1b11a02f170;p=thirdparty%2Ftornado.git twisted: Be more tolerant of leaked current IOLoops in tests --- diff --git a/tornado/platform/twisted.py b/tornado/platform/twisted.py index 613e7b6dc..f8d32193e 100644 --- a/tornado/platform/twisted.py +++ b/tornado/platform/twisted.py @@ -317,6 +317,7 @@ class _TestReactor(TornadoReactor): """ def __init__(self): # always use a new ioloop + IOLoop.clear_current() IOLoop(make_current=True) super(_TestReactor, self).__init__() IOLoop.clear_current() diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index c0a243a9b..1d75904a4 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -94,6 +94,7 @@ def restore_signal_handlers(saved): class ReactorTestCase(unittest.TestCase): def setUp(self): self._saved_signals = save_signal_handlers() + IOLoop.clear_current() self._io_loop = IOLoop(make_current=True) self._reactor = TornadoReactor() IOLoop.clear_current()