asyncio/tests: Ensure a gc_collect for __del__ testing
Patch by Philip Jenvey
This commit is contained in:
parent
5dc093336f
commit
f11352c114
|
@ -628,6 +628,7 @@ class BaseEventLoopTests(test_utils.TestCase):
|
||||||
fut.add_done_callback(lambda *args: self.loop.stop())
|
fut.add_done_callback(lambda *args: self.loop.stop())
|
||||||
self.loop.run_forever()
|
self.loop.run_forever()
|
||||||
fut = None # Trigger Future.__del__ or futures._TracebackLogger
|
fut = None # Trigger Future.__del__ or futures._TracebackLogger
|
||||||
|
support.gc_collect()
|
||||||
if PY34:
|
if PY34:
|
||||||
# Future.__del__ in Python 3.4 logs error with
|
# Future.__del__ in Python 3.4 logs error with
|
||||||
# an actual exception context
|
# an actual exception context
|
||||||
|
|
|
@ -242,6 +242,7 @@ class FutureTests(test_utils.TestCase):
|
||||||
fut.set_exception(RuntimeError('boom'))
|
fut.set_exception(RuntimeError('boom'))
|
||||||
del fut
|
del fut
|
||||||
test_utils.run_briefly(self.loop)
|
test_utils.run_briefly(self.loop)
|
||||||
|
support.gc_collect()
|
||||||
self.assertTrue(m_log.error.called)
|
self.assertTrue(m_log.error.called)
|
||||||
|
|
||||||
@mock.patch('asyncio.base_events.logger')
|
@mock.patch('asyncio.base_events.logger')
|
||||||
|
|
Loading…
Reference in New Issue