]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
asyncio/tests: Ensure a gc_collect for __del__ testing
authorYury Selivanov <yselivanov@sprymix.com>
Fri, 13 May 2016 20:10:43 +0000 (16:10 -0400)
committerYury Selivanov <yselivanov@sprymix.com>
Fri, 13 May 2016 20:10:43 +0000 (16:10 -0400)
Patch by Philip Jenvey

Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_futures.py

index d6607179167ab1d55b1aed8a4a77e600e326468d..a74ac8963a2a2c58f31a80fe1c319d33b127b22c 100644 (file)
@@ -628,6 +628,7 @@ class BaseEventLoopTests(test_utils.TestCase):
             fut.add_done_callback(lambda *args: self.loop.stop())
             self.loop.run_forever()
             fut = None # Trigger Future.__del__ or futures._TracebackLogger
+            support.gc_collect()
             if PY34:
                 # Future.__del__ in Python 3.4 logs error with
                 # an actual exception context
index 358b190072338aa9aa1611df65de255993a9c790..e80010623b27a35131f54504d9a4b4f881e5aefd 100644 (file)
@@ -242,6 +242,7 @@ class FutureTests(test_utils.TestCase):
         fut.set_exception(RuntimeError('boom'))
         del fut
         test_utils.run_briefly(self.loop)
+        support.gc_collect()
         self.assertTrue(m_log.error.called)
 
     @mock.patch('asyncio.base_events.logger')