summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2016-05-16 19:38:39 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2016-05-16 19:38:39 (GMT)
commit7661db622892c9731c502ccdd7af130cbfd23f5c (patch)
tree3d0d940b0a5a26a1a89e27f6e4969ae612a9cb9b /Lib/test/test_asyncio
parent7ed7ce6ee76c1e4aaa94151f156fb2ba5163b5b2 (diff)
downloadcpython-7661db622892c9731c502ccdd7af130cbfd23f5c.zip
cpython-7661db622892c9731c502ccdd7af130cbfd23f5c.tar.gz
cpython-7661db622892c9731c502ccdd7af130cbfd23f5c.tar.bz2
Issue #27041: asyncio: Add loop.create_future method
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_futures.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index e800106..c38c1f2 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()