From 7661db622892c9731c502ccdd7af130cbfd23f5c Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Mon, 16 May 2016 15:38:39 -0400 Subject: Issue #27041: asyncio: Add loop.create_future method --- Lib/test/test_asyncio/test_futures.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Lib/test/test_asyncio/test_futures.py') diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index e80010623b..c38c1f29e7 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -278,14 +278,15 @@ class FutureTests(test_utils.TestCase): f2 = asyncio.wrap_future(f1) self.assertIs(f1, f2) - @mock.patch('asyncio.futures.events') - def test_wrap_future_use_global_loop(self, m_events): - def run(arg): - return (arg, threading.get_ident()) - ex = concurrent.futures.ThreadPoolExecutor(1) - f1 = ex.submit(run, 'oi') - f2 = asyncio.wrap_future(f1) - self.assertIs(m_events.get_event_loop.return_value, f2._loop) + def test_wrap_future_use_global_loop(self): + with mock.patch('asyncio.futures.events') as events: + events.get_event_loop = lambda: self.loop + def run(arg): + return (arg, threading.get_ident()) + ex = concurrent.futures.ThreadPoolExecutor(1) + f1 = ex.submit(run, 'oi') + f2 = asyncio.wrap_future(f1) + self.assertIs(self.loop, f2._loop) def test_wrap_future_cancel(self): f1 = concurrent.futures.Future() -- cgit v1.2.1