From: Yury Selivanov Date: Fri, 13 May 2016 20:10:43 +0000 (-0400) Subject: asyncio/tests: Ensure a gc_collect for __del__ testing X-Git-Tag: v3.6.0a1~27^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f11352c1144eff874d56620678a49b5a6b5d3771;p=thirdparty%2FPython%2Fcpython.git asyncio/tests: Ensure a gc_collect for __del__ testing Patch by Philip Jenvey --- diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index d6607179167a..a74ac8963a2a 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -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 diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index 358b19007233..e80010623b27 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -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')