]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
twisted: Be more tolerant of leaked current IOLoops in tests
authorBen Darnell <ben@bendarnell.com>
Mon, 23 Oct 2017 03:36:30 +0000 (23:36 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 5 Nov 2017 20:42:31 +0000 (15:42 -0500)
tornado/platform/twisted.py
tornado/test/twisted_test.py

index 613e7b6dccad65bba217d05155ee1418206ac673..f8d32193ea243e6c256eea37d58230d4a4ef30e2 100644 (file)
@@ -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()
index c0a243a9bbe6852900a24e640e097f252e2eed8b..1d75904a4321bd1b2c9e69b61e7d6ebbf5f90b6d 100644 (file)
@@ -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()