[Python-checkins] cpython (merge 3.4 -> default): Merge 3.4 (asyncio)

victor.stinner python-checkins at python.org
Fri Dec 19 17:11:50 CET 2014


https://hg.python.org/cpython/rev/b264f7b5dc99
changeset:   93929:b264f7b5dc99
parent:      93927:3de678cd184d
parent:      93928:13f206394380
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Dec 19 17:11:10 2014 +0100
summary:
  Merge 3.4 (asyncio)

files:
  Lib/asyncio/windows_events.py                |  5 +++++
  Lib/test/test_asyncio/test_windows_events.py |  8 ++++++--
  2 files changed, 11 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -427,6 +427,11 @@
         return self._register(ov, None, finish_connect_pipe, wait_for_post=True)
 
     def wait_for_handle(self, handle, timeout=None):
+        """Wait for a handle.
+
+        Return a Future object. The result of the future is True if the wait
+        completed, or False if the wait did not complete (on timeout).
+        """
         if timeout is None:
             ms = _winapi.INFINITE
         else:
diff --git a/Lib/test/test_asyncio/test_windows_events.py b/Lib/test/test_asyncio/test_windows_events.py
--- a/Lib/test/test_asyncio/test_windows_events.py
+++ b/Lib/test/test_asyncio/test_windows_events.py
@@ -98,8 +98,10 @@
         # result should be False at timeout
         fut = self.loop._proactor.wait_for_handle(event, 0.5)
         start = self.loop.time()
-        self.loop.run_until_complete(fut)
+        done = self.loop.run_until_complete(fut)
         elapsed = self.loop.time() - start
+
+        self.assertEqual(done, False)
         self.assertFalse(fut.result())
         self.assertTrue(0.48 < elapsed < 0.9, elapsed)
 
@@ -109,8 +111,10 @@
         # result should be True immediately
         fut = self.loop._proactor.wait_for_handle(event, 10)
         start = self.loop.time()
-        self.loop.run_until_complete(fut)
+        done = self.loop.run_until_complete(fut)
         elapsed = self.loop.time() - start
+
+        self.assertEqual(done, True)
         self.assertTrue(fut.result())
         self.assertTrue(0 <= elapsed < 0.3, elapsed)
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list