[Python-checkins] cpython (3.5): asyncio/tests: Ensure a gc_collect for __del__ testing
yury.selivanov
python-checkins at python.org
Fri May 13 16:11:05 EDT 2016
https://hg.python.org/cpython/rev/c862fc979ef9
changeset: 101329:c862fc979ef9
branch: 3.5
parent: 101327:d4facabab91a
user: Yury Selivanov <yselivanov at sprymix.com>
date: Fri May 13 16:10:43 2016 -0400
summary:
asyncio/tests: Ensure a gc_collect for __del__ testing
Patch by Philip Jenvey
files:
Lib/test/test_asyncio/test_base_events.py | 1 +
Lib/test/test_asyncio/test_futures.py | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -628,6 +628,7 @@
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
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -242,6 +242,7 @@
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')
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list