[Python-checkins] cpython (merge 3.4 -> default): Merge 3.4->default: Fix test-order-dependend asyncio test failure caused by rev

guido.van.rossum python-checkins at python.org
Tue May 13 18:21:44 CEST 2014


http://hg.python.org/cpython/rev/0bb92c9fdb35
changeset:   90688:0bb92c9fdb35
parent:      90686:8885fc2e92b3
parent:      90687:16d0bcce10de
user:        Guido van Rossum <guido at python.org>
date:        Tue May 13 09:21:33 2014 -0700
summary:
  Merge 3.4->default: Fix test-order-dependend asyncio test failure caused by rev 2af5a52b9b87 (in this branch).

files:
  Lib/test/test_asyncio/test_streams.py |  15 +++++++++------
  1 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -593,9 +593,6 @@
         # of the data writter.  Also we must explicitly attach a child
         # watcher to the event loop.
 
-        watcher = asyncio.get_child_watcher()
-        watcher.attach_loop(self.loop)
-
         code = """\
 import os, sys
 fd = int(sys.argv[1])
@@ -611,9 +608,15 @@
         transport, _ = self.loop.run_until_complete(
             self.loop.connect_read_pipe(lambda: protocol, pipe))
 
-        proc = self.loop.run_until_complete(
-            asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
-        self.loop.run_until_complete(proc.wait())
+        watcher = asyncio.SafeChildWatcher()
+        watcher.attach_loop(self.loop)
+        try:
+            asyncio.set_child_watcher(watcher)
+            proc = self.loop.run_until_complete(
+                asyncio.create_subprocess_exec(*args, pass_fds={wfd}, loop=self.loop))
+            self.loop.run_until_complete(proc.wait())
+        finally:
+            asyncio.set_child_watcher(None)
 
         os.close(wfd)
         data = self.loop.run_until_complete(reader.read(-1))

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


More information about the Python-checkins mailing list